Amazon Web Services

From Leo's Notes
Last edited on 15 June 2020, at 00:04.

Some notes on Amazon Web Services (AWS)

Pricing[edit | edit source]

There are 4 models for Amazon Elastic Compute (EC2):

On-Demand Instances
Pay per hour or per second. Most expensive.
Reserved Instances
Discounted up to 75% compared to On-Demand but must commit to a 1 or 3 year term. Pay up front.
Savings Plan (Compute or Instance)
Replaces Reserved Instances. You buy a fixed amount of EC2 credit (with some discount) up front to be used by any On-Demand instances (Compute Savings Plan) or any On-Demand instances of a particular family (Instance Savings Plan). A Instance Savings Plan offers less flexibility but slightly higher discount.
Spot Instances
Request spare computing capacity by making a bid and having it fulfilled when the price drops below your bid. Cheapest but instance can be terminated at any time.
Dedicated Hosts
An entire dedicate host is reserved.

When looking at pricing for a particular VM, keep in mind that you must pay for:

  1. Compute time (eg. $0.001/hr for spot instances, or $0.01/hr for on-demand)
  2. Storage (EBS at $0.11/GB/mo or more for higher IO)
  3. Bandwidth ($0.09/GB)

The minimum amount of storage each VM running Linux can be created with is 8GB.


Instance Types[edit | edit source]

Instance type overview:

Prices for on-dmand and spot pricing can be found at:

Price Examples[edit | edit source]

There are many different instance types. The 12 month free eligible type is t2.micro which comes with 1 vCPU, 1GB RAM. The value of the t2.micro VM in US East (Ohio) is about $10/mo:

  • $0.01 per hour * 720 hours/month ($7.20)
  • $0.1 per GB/mo storage * 30 GB ($3)
  • $0.09 per GB/mo bandwidth

In comparison, a t3a.nano using spot pricing costs about $4/mo:

  • $0.0016 per hour * 720 hours/month ($1.15)
  • $0.1 per GB/mo storage * 30 GB ($3)
  • $0.09 per GB/mo bandwidth

CPU Credits[edit | edit source]

Burstable instances such as the t2 or t3 instances have CPU credits. Any CPU usage on the instance will use credits (at 1 credit per CPU/minute). Depending on the instance type, an instance will accrue a certain amount of credit every hour. Accounting is performed at a millisecond resolution.

More information can be found on AWS's documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html

Mail Server[edit | edit source]

Port 25 is throttled. To run a mail server, request the removal of sending limitations using the following form:

After completing this form and providing the Elastic IP and DNS name, AWS will create a reverse DNS.

Despite using an IP that was not flagged by SpamHaus (spamhaus.org/lookup/), some emails that were forwarded through this AWS VM was not accepted by Gmail with the following message:

<xxxx@gmail.com> (expanded from <xxx@steamr.com>): host gmail-smtp-in.l.google.com[172.217.197.26] said: 
550-5.7.1 [35.183.156.23018] Our system has detected that this message is
550-5.7.1 likely suspicious due to the very low reputation of the sending IP
550-5.7.1 address. To best protect our users from spam, the message has been
550-5.7.1 blocked. Please visit 
550 5.7.1 https://support.google.com/mail/answer/188131 for more information.
t43si25325977qtc.22 - gsmtp (in reply to end of DATA command)

Moving the mail server back to a VM in Luxembourg with BuyVM resolved this issue.

Cloud-Init[edit | edit source]

The cloud init script can be found at /var/lib/cloud/instance/scripts/part-001. Logs from first start up can be found in /var/log/cloud-init.log and /var/log/cloud-init-output.log.

Alternatives[edit | edit source]

Looking at just the pricing, AWS EC2 is actually very expensive for what you get. Others have mentioned alternatives including:

  • Vultr
  • DigitalOcean
  • Linode
  • OVH

If a VM to run some workload is all you need, some low end VPS packages from WHT offers are also valued very well.

Alternatively, create a AWS instance using spot pricing. Eg. The t3a.nano instance type comes with 2 CPU cores, 512MB memory and costs $0.0016/hr, or $1.20 per month.