How to minimize the GCP cloud SQL billing - google-cloud-platform

I am using Google Cloud Platform (Free Tier) for testing my application. I am using Cloud SQL and my DB size is 1 GB (Images). I am just testing the app so the number of users is only 1. The max time I spent is less than 2 hours per day (120 minutes max). But when I observe the billing, it says that I spent around Rs. 4000 (Indian Rupees-4K) per month.
Details: DB standard Intel N1 1 VCPU running in Mumbai (with 30% promotional discount).
How can I reduce the billing amount?

The Cloud SQL instances basically charged on hourly basis. If you are using it for testing purpose alone, then it is better to stop the instance once you are done with the work and start it whenever you need. By doing this you can avoid getting charged for non-usage period and you pay only for the data storage alone.
Refer this pricing chart for Cloud SQL and refer this one for start-stop-restart instances.

Related

cloud run billing - execution time

I have been using cloud run on GCP for several years. I recently moved a service over from AWS Lambda, which costs me like 10 dollars a month, but on cloud run it went to 50 dollars per day. The cloud run service is simply a background worker that should ideally run for 3 minutes max. It loads, schedules, and summarizes jobs. If there are 50 jobs, it should run 50 background workers so it can bursts, which cloud run complains that it cannot allocate quickly enough. Since I use a distributed lock, there should be only 50 workers running regardless.
I tried to figure out the costs breakdown and GCP in my experience does not provide any defaults. I click on the costs breakdown and it just shows me a graph of the monthly costs going from 50 dollars to 800 dollars per month. There is no costs breakdown. I'll try to implement labels, but in general, how do I determine the costs break down for cloud run. AWS lambda is simple because it essentially reduces to execution costs especially within the same VPC.
Besides labels, how do I determine the costs for cloud run? When I drill down further is this CPU allocation that is huge costs, both in tier 2 and standard tier?
Any suggestions or help would be great :)

Google cloud compute engine always free tier

I am trying to run a compute engine instance using the always free tier option. The documentation of the free tier says if it is a computer engine instance of e2-micro from certain locations, it should be free. Here is the screenshot:
Now, I have chosen e2-micro with standard persistent disk of 10GB (one can not go below 10GB in GCP platform) at us-central1 location (which is one of the free tier location). It still shows an estimate of $6.51 monthly cost. Here is the screenshot of the instance configuration:
Am I doing something wrong here? Is there any other option I need to check to make sure it stays in the always free tier?
An e2-micro instance is not (in and of itself) free. I think the estimate you are seeing is in fact the cost of running an instance. What makes it "free" is that Google will "waive" the fees for the resources described as "free tier". However, if you run more and more e2-micro instances beyond the amount offered as a "free taster" then you will be charged the rate listed.
Looking in detail at the first image that Syed posted we see the following at the bottom:
Your Free Tier e2-micro instance limit is by time, not by instance. Each month, eligible use of all of your e2-micro instance is free until you have used a number of hours equal to the total hours in the current month.
Putting it another way, you get this amount of resource for free. For example, if we assume that a month is approximately 720 hours then that is the amount of e2-micro consumption you get free in monthly billing cycle. Whether you run 1 instance of CPU consumption for the whole month or 720 instances for only 1 hour. Take care to note that resources are broken down into their chargeable components (CPU, disk, network egress).
Disclaimer: Nothing in this post should be taken as a formal Google statement ... please consult Google documentation such as Google Cloud Free Program for accurate details.

Is it possible to use ON_DEMAND pricing for Cloud SQL any longer?

I keep finding old posts about an on demand pricing option for Cloud SQL, but I see no more references in Google's documentation on how to enable it? Did this feature go away?
If so, can someone provide me a recommendation on an alternative for hosting a MySQL DB? Cloud SQL is just too much if I have to always be running the instance.
As per the GCP doc Cloud SQL for MySQL pricing is charged for every second. This means that each second of usage counts towards a full billable minute. For example, If you use an instance for 1.5 seconds or 2.49 seconds, in both cases you are billed for 2 seconds.

Is Google Cloud Trial enough for academic project?

We are going to use Kubernetes Engine, Cloud SQL, Storage, and possibly Nosql and cache services for our academic project.
So far we'll have 5 accounts and the project has to be running for 3 months.
Will it be enough for us? Is it possible, for example, to stop project and billing every night or even stop and start at any time?
The Google Cloud Platform (GCP) Free Tier includes $300.00 USD in credits to get started with any GCP product. Since this is an academic project, I recommend using the Google Cloud Platform Pricing Calculator to learn how to price GCP products and services - link. Also review what is included in the "Always Free Products" - link. Then there are discounts for services that run for a majority of the month - "Sustained Usage Discounts" - link.
Google Kubernetes Engine:
Kubernetes Engine is free (the worker nodes are not free).
If you select n1-standard-1 (1 vCPU, 3.75 GB mem) the cost is $24.27 per month per node. Typically you will create a three node cluster: round up to $75.00 per month.
Google Cloud SQL:
Selecting a db-pg-f1-micro (PostgreSQL) with 32 GB of SSD storage: $24.27 per month
Will it be enough for us?
As you can see, you will quickly burn thru $300.00 in credit in only three months.
Take into consideration that Google's goal is not to give away services. The goal is to introduce you to Google Cloud and provide enough services at zero or low cost so that you can complete an evaluation of Google Cloud.
Is it possible, for example, to stop project and billing every night
or even stop and start at any time?
No, you cannot start and stop billing every night. In order to stop billing for a project you must delete the project and everything in it. Some services such as Google Compute Engine (GCE) can be stopped. This stops billing for the VM instance but billing for storage, snapshots, IP addresses, etc. continues unless you delete your instances every night and recreate them each morning.
Services such as Kubernetes or Google Cloud SQL cannot be completely shutdown. Technically you could by deleting everything but then recreating everything takes more time than the savings gained. Very good for practice however.
Google Cloud services would be a great option for your circumstances.
If its budgetary constraint you may want to look into using AWS, AWS will provde you with a years time for free which would be good for your horizontal scaling with k8s
Amazon and Kubernetes

What is Amazon Web Services RDS month-to-date usage?

I have one RDS instance on AWS under the free tier, and I've been monitoring the resources I'm using. Under the free tier, I have 20 GB-Mo of RDS - Storage and 750 Hrs of RDS - Instance. I have just one RDS instance, but my Month-end forecasted usage surpasses the free tier limits, even if I'm not even using it (the RDS Instance is active, but I'm not effectively using it for anything yet).
Since I have just one RDS instance active, it doesn't make sense that I'm surpassing RDS instance free tier usage, I think. I just wanted to clarify if those two services (RDS-Storage and RDS-Instance) actually mean what I think (RDS-Storage is the amount of actual storage I'm using from my RDS database and RDS-Instance is the amount of time the instance has been running since the start of the month, right?).
Am I missing anything? (I know that I'm not giving much information, but I'm new to AWS and I don't know which kind of information would be useful)
AWS only can answer this question and here is their explanation.
The "Forecast" function is designed to be a rough prediction of your
monthly AWS usage, based on your month-to-date charges.
Although most AWS services bill on-demand, meaning your overall bill
steadily increases over the course of a month, some services or
features bill a larger amount once, usually on or near the first of
the month.
This might cause your forecasted usage to appear higher than you
expect at the beginning of a month, because your average daily cost is
higher at the beginning of the month than it will be over the course
of that month. As the month progresses, your usage should normalize,
and the forecast will be a more accurate prediction of your final
monthly bill.
More can be read from :
https://aws.amazon.com/premiumsupport/knowledge-center/high-aws-cost-forecast/
http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-forecast.html