2020 Update - Change to IP Pricing
On January 2020, Google has made change to Google Cloud’s IP pricing.
https://cloud.google.com/vpc/pricing#ipaddress
From on, External IP Address will be charged for each vm instance.
However for Always Free (Free Tier) vm instance, this is excempt, and you do not need to pay usage charge.
More description can be found from link below:
Old Post from below
Google App Engine is a great choice when you want to host small website for free.
To make sure you don’t go beyond the free usage limits, or to save some costs, here are some strategies you can take.
app.yaml
default_expiration and expiration
- url: /css
static_dir: public/css
expiration: "7d"
- url: /js
static_dir: public/js
expiration: "7d"
expiration element allows to control the length of caching.
If you are certain the served content does not change for x amount of time, you can set the value to x.
NOTE: Once you set this, the cache will spread across all Google Servers (eg Proxy), which means, you will not visualise the change to cached content until cache expiry have reached. It is best to set expiration to low value when debugging.
automatic_scaling
automatic_scaling:
max_instances: 1
max_idle_instances: 1
min_pending_latency: "3000ms"
Free usage limit for instance is 28 frontend instance hours per day, 9 backend instance hours.
By default, App Engine scales your app to match the load. Your apps will scale up the number of instances that are running to provide consistent performance which could result in sooner use up of hours.
You can restrict to at most 1 instance with above values.
Billing Control
You can control the spending as describe in this page.
Set to zero and you are guaranteed of no charge!
For extra safenet, you can create budget alert where if amount reaches threshold, you will be notified.