A step-by-step guide for AWS EC2 provisioning using Terraform: AWS EC2 Pricing— Part 7

Joel Wembo
6 min readJun 21, 2024

--

AWS EC2 Pricing Model. EC2 billing is flexible! Skip the monthly fee and choose how you pay. Get started for as low as $0.0052 per hour or snag up to 90% off with Spot Instances.

To enhance readability, this handbook is divided into chapters and split into parts. The first, part, “A step-by-step guide for AWS EC2 provisioning using Terraform: HA, ALB, VPC, and Route53 — Part 1”, and the second part “A step-by-step guide for AWS EC2 provisioning using Terraform: HA, CloudFront, WAF, and SSL Certificate — Part 2”, and “A step-by-step guide for AWS EC2 provisioning using Terraform: Cloud Cost Optimization, AWS EC2 Spot Instances — Part 3”, was covered in a separate article to keep the reading time manageable and ensure focused content. The next part or chapter will be published in the next post, upcoming in a few days, “A step-by-step guide for AWS EC2 provisioning using Terraform: VPC peering, VPN, Site-to-site Connection, tunnels ( multi-Cloud ) — Part 9“ and so much more !!

Amazon EC2 offers a few different pricing models to fit your needs:

  • On-Demand Instances: This is the most flexible option, where you pay by the second for the compute resources you use. Prices start at $0.0052 per hour for T2 instances.
  • Savings Plans: You can commit to a fixed usage level for a one- or three-year term to get significant discounts compared to on-demand pricing.
  • Reserved Instances: Reserve specific instances for a term of one or three years for an even steeper discount than Savings Plans.
  • Spot Instances: Bid on unused EC2 capacity for up to 90% off the on-demand price. This is the most cost-effective option, but the availability of Spot Instances can fluctuate.
Linux cloud hosting: performance index below 16 ( < 2CPU, 8GB RAM) by Wikipedia
Linux cloud hosting: performance index 16–1040 (2CPU, 8GB RAM — 16CPU, 65GB RAM) by Wikipedia

When comparing the pricing models of Amazon EC2 (Amazon Web Services), Azure Virtual Machines (Microsoft Azure), and Google Compute Engine (Google Cloud Platform), several factors need to be considered. These factors include on-demand pricing, reserved instances or committed use contracts, spot instances/preemptible VMs, as well as any unique features or discounts each provider offers.

AWS VS Azure vs GCP

On-Demand Pricing

Amazon EC2:

  • Pricing Model: Pay for computing capacity by the hour or by the second with no long-term commitments.
  • Example: A t3.medium instance (2 vCPUs, 4 GiB RAM) in the US East (N. Virginia) region costs approximately $0.0416 per hour.

Azure Virtual Machines:

  • Pricing Model: Pay per second, with no upfront costs or long-term commitments.
  • Example: A B2s instance (2 vCPUs, 4 GiB RAM) in the East US region costs approximately $0.0464 per hour.

Google Compute Engine:

  • Pricing Model: Pay per second with a minimum of one minute of usage.
  • Example: An e2-medium instance (2 vCPUs, 4 GiB RAM) in the us-central1 region costs approximately $0.033174 per hour.

Resources to help you learn more about AWS EC2 pricing

Source: AWS
  • Amazon EC2 Pricing Page: https://aws.amazon.com/ec2/pricing/
  • AWS Pricing Calculator: You can use this tool to estimate the cost of your EC2 usage based on your specific needs [AWS Pricing Calculator]
Generate a Quick Estimate: Source: AWS
  • Amazon EC2 Instance Comparison: This tool allows you to compare the features and pricing of different EC2 instance types [EC2 Instance Comparison Tool]

### If you want to know more about cost optimization using Terraform, CloudWatch, Lambda, and SNS in practice, the link is provided ###

A step-by-step guide for AWS EC2 provisioning using Terraform: Cloud Cost Optimization, AWS EC2 Spot Instances with CloudWatch, SNS and Lambda — Part 3

Update: Once you are done with this tutorial, you might to check up a follow-up tutorial on the next part, A step-by-step guide for AWS EC2 provisioning using Terraform: Automating aws ec2 ubuntu AMIs using terraform aws_ami data source — Part 8

Conclusion

Skip the upfront fees with the EC2 launch type! You only pay for the resources you use, like the EC2 instances themselves, billed by the second (with a minimum of 60 seconds).

Here’s how to save on your Amazon ECS costs:

  • Use spot instances: These are super-discounted instances with fluctuating availability, perfect for workloads that can handle interruptions.
  • Auto-scale your resources: Only pay for what you need by automatically adjusting the number of instances based on demand.
  • Schedule workloads: Run compute-intensive tasks during off-peak hours when prices might be lower.
  • Monitor performance: Keep an eye on your resource usage with CloudWatch to identify areas for optimization.

To enhance readability, this handbook is divided into chapters and split into parts. The first, part, “A step-by-step guide for AWS EC2 provisioning using Terraform: HA, ALB, VPC, and Route53 — Part 1”, and the second part “A step-by-step guide for AWS EC2 provisioning using Terraform: HA, CloudFront, WAF, and SSL Certificate — Part 2”, and “A step-by-step guide for AWS EC2 provisioning using Terraform: Cloud Cost Optimization, AWS EC2 Spot Instances — Part 3”, was covered in a separate article to keep the reading time manageable and ensure focused content. The next part or chapter will be published in the next post, upcoming in a few days, “A step-by-step guide for AWS EC2 provisioning using Terraform: VPC peering, VPN, Site-to-site Connection, tunnels ( multi-Cloud ) — Part 9“ and so much more !!

Thank you for Reading !! 🙌🏻, don’t forget to subscribe and give it a CLAP 👏, and if you found this article useful contact me or feel free to sponsor me to produce more public content. see me in the next article.🤘

About me

I am Joel Wembo, AWS certified cloud Solutions architect, Back-end developer, and AWS Community Builder, I‘m based in the Philippines 🇵🇭; and currently working at prodxcloud as a DevOps & Cloud Architect. I bring a powerful combination of expertise in cloud architecture, DevOps practices, and a deep understanding of high availability (HA) principles. I leverage my knowledge to create robust, scalable cloud applications using open-source tools for efficient enterprise deployments.

I’m looking to collaborate on AWS CDK, AWS SAM, DevOps CI/CD, Serverless Framework, CloudFormation, Terraform, Kubernetes, TypeScript, GitHub Actions, PostgreSQL, and Django.”

Thank you for Reading !! 🙌🏻, don’t forget to subscribe and give it a CLAP 👏, and if you found this article useful contact me or feel free to sponsor me to produce more public content. see me in the next article.🤘

For more information about the author ( Joel O. Wembo ) visit:

Links:

--

--

Joel Wembo

I am a Cloud Solutions Architect at prodxcloud. Expert in AWS, AWS CDK, EKS, Serverless Computing and Terraform. https://www.linkedin.com/in/joelotepawembo