Compare EC2 purchasing options and storage tiers without buying anything

short · 25 min · Task statement 4.1

Task

Read, from your own account, the purchasing options the lesson compares: today's Spot price for one small instance type in each Availability Zone, the Reserved Instance offerings for the same type with their terms, payment options, offering classes and scope, and which services each kind of Savings Plan covers. Then read the S3 pricing page to see which dimensions storage is charged on and how data transfer in differs from data transfer out. Every command reads; nothing is bought, reserved or created, and the lab ends by proving that.

Steps

  1. List the Availability Zones in the Region; Spot prices are set per zone:
aws ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName' --output text
  1. Read the current Spot price of a t3.micro running Linux in each zone:
aws ec2 describe-spot-price-history --instance-types t3.micro --product-descriptions 'Linux/UNIX' --start-time $(date -u +%Y-%m-%dT%H:%M:%S) --query 'SpotPriceHistory[].[AvailabilityZone,SpotPrice]' --output table

Open the Amazon EC2 On-Demand pricing page, choose the same Region and operating system, and find t3.micro. Compare its hourly On-Demand rate with the Spot prices: Spot is spare capacity at a steep discount, and the price differs between zones and moves over time. It is cheapest because AWS can take it back after a short warning. 3. Read the Standard Reserved Instance offerings for the same type, regional scope only, leaving out third-party listings:

aws ec2 describe-reserved-instances-offerings --instance-type t3.micro --product-description 'Linux/UNIX' --instance-tenancy default --offering-class standard --no-include-marketplace --filters Name=scope,Values=Region --query 'ReservedInstancesOfferings[].[OfferingClass,Duration,OfferingType,FixedPrice]' --output table

Duration is in seconds: 31536000 is one year and 94608000 is three. OfferingType is the payment option: All Upfront, Partial Upfront or No Upfront. The more is paid up front, and the longer the term, the lower the effective rate. These are offerings to read, not purchases. 4. Run the same command with --offering-class convertible in place of --offering-class standard. The same terms and payment options appear, at slightly less of a discount: that is the price of being able to exchange the reservation for a different instance family, operating system or tenancy during its term. Every row you have seen has the scope Region, which means the discount applies in any zone of the Region but reserves no capacity. 5. Read which services each kind of Savings Plan covers:

aws savingsplans describe-savings-plans-offerings --region us-east-1 --plan-types Compute --max-results 1 --query 'searchResults[0].productTypes' --output text
aws savingsplans describe-savings-plans-offerings --region us-east-1 --plan-types EC2Instance --max-results 1 --query 'searchResults[0].productTypes' --output text

A Compute Savings Plan covers EC2, Fargate and Lambda, in some order; an EC2 Instance Savings Plan covers EC2 alone, tied to one instance family in one Region, for a larger discount. 6. Open the Amazon S3 pricing page. On the Storage tab, read down the storage classes from S3 Standard to S3 Glacier Deep Archive and see the storage rate fall. On the Requests and data retrievals tab, see that the Infrequent Access and Glacier classes add a charge to read data back, which S3 Standard does not. On the Data transfer tab, compare data transfer in from the internet with data transfer out to the internet, and find the rows for transfer to another AWS Region. Those three tabs are the dimensions the lesson lists: amount stored by class, requests and retrievals, and transfer out. 7. Prove that nothing was bought. These read your account's own reservations and plans:

aws ec2 describe-reserved-instances --query 'length(ReservedInstances)'
aws savingsplans describe-savings-plans --region us-east-1 --query 'length(savingsPlans)'

Both print 0, unless your account already held reservations or plans before this lab.

Verify

The convertible offerings are there to compare:

aws ec2 describe-reserved-instances-offerings --instance-type t3.micro --product-description 'Linux/UNIX' --instance-tenancy default --offering-class convertible --no-include-marketplace --filters Name=scope,Values=Region --query 'ReservedInstancesOfferings[0].OfferingClass' --output text

Expected output: convertible.

An EC2 Instance Savings Plan covers EC2 only:

aws savingsplans describe-savings-plans-offerings --region us-east-1 --plan-types EC2Instance --max-results 1 --query 'searchResults[0].productTypes' --output text

Expected output: EC2.

You hold no reservation:

aws ec2 describe-reserved-instances --query 'length(ReservedInstances)'

Expected output: 0 (or the number you held before this lab).

Cost and clean-up

Every command in this lab is a read, and reading offerings, prices and history costs nothing. The only way this lab could cost money is a purchase, which it never makes.

Created by this lab: nothing.

  1. There is nothing to delete: the lab only read. Confirm that no purchase, reservation or Spot request was made by mistake, using the checks below.

Check it is gone

aws savingsplans describe-savings-plans --region us-east-1 --query 'length(savingsPlans)'

Expected output: 0 (or the number you held before this lab).

aws ec2 describe-capacity-reservations --query 'length(CapacityReservations)'

Expected output: 0 (or the number you held before this lab).

aws ec2 describe-spot-instance-requests --query 'length(SpotInstanceRequests)'

Expected output: 0 (or the number you held before this lab).

Notes

Match each scenario to an option, using what you read: a batch job that can stop and restart, at the lowest cost (Spot Instances); a database server that runs unchanged for three years (a Standard Reserved Instance or an EC2 Instance Savings Plan); steady spend that will move between instance families and onto Lambda (a Compute Savings Plan); a licence priced per physical core (Dedicated Hosts); guaranteed capacity in one zone for a weekend event, with no term (an On-Demand Capacity Reservation).

Reserved Instance and Savings Plans discounts are shared across the accounts of an AWS Organizations consolidated billing family by default, which lesson 24 covers.

This is an independent study companion for the AWS Certified Cloud Practitioner (CLF-C02) exam and is not produced by or endorsed by Amazon Web Services. AWS, Amazon Web Services and AWS Certified Cloud Practitioner are trademarks of Amazon.com, Inc. or its affiliates.

This is an independent study companion for AWS Certified Cloud Practitioner CLF-C02 and is not produced by or endorsed by CompTIA.