How can we monitor the Google app engine (egress)traffic like the VMs instance ?
since The GAE of Google Cloud Free Tier has 1 GB of egress per day for Standard Environment.
would like to monitor my app egress traffic to budget myself. Thank you.
“Out Bandwidth” SKU and the “Network Sent Bytes” Metric in the dashboard can confirm the network egress price and billing. The appengine.googleapis.com/system/network/sent_bytes_count is the metric which provides the Delta count of outgoing network bandwidth, sampled every 60 seconds.
App Engine standard has an outgoing network traffic cost of about $0.12/Gb and Out Bandwidth is 0.00 USD (Free) per gibibyte, for 0 to 1 gibibyte, per day per project and 0.12 USD per gibibyte, for 1 gibibyte and above, per day per project
If you look at the Network usage on Metrics Explorer you can find further information about the usage and the tendency that will match the billing made for Out Bandwidth.
On actively looking into your request to see if there is a way to see App engine egress that would correlate with the increase in billing. I'm trying to figure out the settings/parameters you would need to set in order to see the total accumulated bytes sent out by app engine
Go to metrics explorer in cloud console
For "Select a Metric" : GAE -> System -> Sent bytes
At the top of the chart be sure to select "1M"(1 Month) & change
"line chart" to "Stacked Bar Chart" in the dropdown <--- very
important
In the "How do you want to view that data?" section put in the
following:
Groupby : Projectid
Aggregator: Max
Minimum Alignment Period : 1 day
Under "show advanced advanced options" section put the following :
Aligner: Sum
Leave the rest as is.
Note : Leave the rest as is, just remember to set the chart to 1 month and a stacked bar chart.
Also, this documentation talks about the scenarios and different multiple sources from where you are charged for egress traffic and it's not always only GAE.
By log sampling I mean that not all the logs are saved to Stackdriver but just a sample of them. Useful for high traffic applications.
I've searched but the only mention I see is here in the context of App Engine Flex and OpenAPI.
There is also an option to sample logs at query time here.
Log sampling is also mentioned as an option for Trace clients here but that doesn't seem applicable to App Engine.
Stackdriver does not have built in support for sampling logs but you can specify a log exclusion filter which will allow you to remove log entries based on a criteria.
If you choose to exclude everything and specify a sampling criteria I think you can achieve this:
The link below explains this in a bit more detail:
https://cloud.google.com/logging/docs/exclusions
Is there any URL that exporting a json file that describes the status of the of a flink cluster service?
I.e sys uptime, jobs status, number of nodes, etc...
You should definitely have a look at the Monitoring REST API.
The documentation for that feature can be accessed here
You can also access some TaskManager metrics, unfortunately they are not yet described in the doc, but you can have a look at source-code: WebRuntimeMonitor
If I for example run scandir on a Google Cloud Storage Bucket folder on an App Engine Application, will this be billed?
I know it costs to connect to the bucket via the JSON and XML API, but I cannot find any info about the gs://.
If it costs anything, does scandir count as 1 class A operation?
If you look at the pricing page, storage.buckets.list (listing buckets within a project) and storage.objects.list (listing objects within a bucket) are both Class A operations, which, as of today (July 16th, 2015) cost $0.01 per 1000 operations.
Some functions in the Google Developers Console, like the Analytics API, are free until you reach a quota. Other functions, like Google Cloud Storage, create costs from the first click.
When I upload a file under https://console.developers.google.com/ > Storage > Cloud Storage > Storage Browser and I make this file publicly available, I pay about $0.12 per GB traffic.
But theoretically the traffic to this link could explode, e.g. because of sudden popularity. Therefore I would like to set something like a daily or monthly cost limit.
Q: How do I protect myself from overly high costs in the Google Developers Console?
You cannot. I asked Google about this, here's their response, from May 7 2016:
(GCE = Google cloud engine. No spending limits.
GAE = Google app engine — yes it has spending limits.)
... you are eligible for support on ... only ...
... [various helpful links] ...
That been said, at the moment there is no a feature that allows you to
configure a limited budget on GCE. This feature is certainly available
for GAE [1]. As you mentioned in your comments, you either can totally
shut down your VMs (will depend on your use case) or set the VMs to
send you alerts if they reach a certain traffic limit [2].
Sincerely,
Someone's first name
Technical Solutions Representative
Google Cloud Platform
[1] https://cloud.google.com/appengine/docs/quotas
[2] https://cloud.google.com/monitoring/support/notification-options
#wmdry, you wrote: "traffic to this link could explode" — I'm afraid of this too. That's why I asked Google about this. And I'm planning to avoid Google's CDN because of this, and use another CDN provider instead, which has spending limits. Because, unlike Nginx, I don't see any way for me to rate limit / throttle Google's CDN.
I do plan to use GCE (Google Cloud Engine) though. Therefore, right now I'm reading about how to rate limit my Nginx server. Because if I just configure Nginx correctly, then those $0.12 / GB you mentioned, cannot possible explode to ... like $10k in a month? What if Google sends a $10k bill when I'm back from an a few week's vacation, just because of my hobby project and a few people downloading a 1 MB movie over and over again forever (because: evil). Hmm, & the bigger & faster my servers, the higher the risk.
I hope Google will add spending limits, because I did want to use Google's CDN.
Update 2020: Apparently this does bite people from time to time — look here:
"Burnt $72k testing Firebase and Cloud Run and almost went bankrupt", Dec 08, 2020, https://news.ycombinator.com/item?id=25372336,
In that case, they could contact Google and in the end didn't need to pay.
As of July 2017 you can set budgets that send notifications via email but do not cap spending:
To set an alert-only budget, which will not cap spending:
Go to the Cloud Platform Console.
Open the console left side menu and click Billing
If you have more than one billing account, click the billing account name.
On the left, click Budgets & alerts.
Official help page: https://support.google.com/cloud/answer/6293540?hl=en
I found that Google's documentation now provides two methods to actually limit the cost of a GCP project. It involves the following setup:
Create a Cloud Function that checks the cost against the budget, and carries out a certain action if the cost exceeds the budget. Google's Documentation provides a sample code snip that can either shutdown all VM instances in a Project or disable the billing for a project. Shutting down all VMs would stop all VM-related cost but you get to keep your data (and still have to pay for the storage). Disabling the billing for a project would effectively zap all cost-related activities and you could lose data. You can name the Cloud Function "budget-enforcer".
The Google code snip as provided above has a hard coded ZONE variable. Remember to change it to match your zone!
Create a Service Account to run the Cloud Function "budget-enforcer". For shutting down VMs, the Service Account would need role "Compute Instance Admin (v1)". For disabling billing on a project, the Service Account would need role "Project Billing Manager".
Set a Topic for the Cloud Function (I call mine "proj-name-stop-vm" and "proj-name-disable-bill").
Set up a budget alert as usual, and connect it to one of the Pub/Sub topic above.
Please be noted that Google's documentation did mention that there could be a delay between the cost exceeds a budget and the function is triggered, so you should build in a buffer if you have an absolute hard cost limit. I use 90% of the budget as the trigger line for shutting down my instances.
The API usage can be limited with a hard limit:
Depending on the API, you can explicitly cap requests in a variety of
ways, including: requests per day, requests per 100 seconds, and
requests per 100 seconds per user. You might want to limit the
billable usage by setting caps. For example, to prevent getting billed
for usage beyond the free courtesy usage limits, you can set requests
per day caps
Source
You can combine budget pub/sub alerts with a cloud function that can disable billing on your entire account if a threshold is met.
Full Tutorial Here:
https://www.youtube.com/watch?v=KiTg8RPpGG4
GitHub Repo Here: https://github.com/aioverlords/Google-Cloud-Platform-Killswitch
To Disable Billing
const _disableBillingForProject = async projectName => {
const res = await billing.updateBillingInfo({
name: projectName,
resource: {
billingAccountName: ''
}, // Disable billing
});
console.log(res);
console.log("Billing Disabled");
return `Billing disabled: ${JSON.stringify(res.data)}`;
};
Simply go to the developer console:
https://console.developers.google.com/project
Select your project.
Select "billings & settings"
Enable billing.
Then go to Compute/AppEngine/Settings and set a daily budget.
Go to Google Cloud console, and then to Billing / Budgets and Alerts and create a new budget for one or all your projects. You can select which services should be included in the limit and set a monthly amount that should not be exceeded.