AWS Design Cost-Optimized Architectures

varunkumar inbaraj
5 min readDec 28, 2019

| Cheat Sheets

Use ECS for container orchestration and a combination of Spot and Reserved Instances for the underlying instances.

it is cost effective to use reserved instances for long term critical batch and spot instances for non critical batch processing requirements. ECS can be used for container orchestration and support spot instances

VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you’ve created a flow log, you can retrieve and view its data in the chosen destination.

Refer AWS documentation — VPC Flow Logs

SQS can help provide loose coupling and act as a buffer for database. Also, as the spike is temporary there is no need to scale the RDBMS.

Note: Auto Scaling does not apply to RDBMS

Serve the website from an Amazon S3 bucket and map a Route 53 alias record to the website endpoint and set the NS records of the domain to use Route 53 name servers.

Refer AWS documentation — Route 53 Routing to S3 bucket

Standard Reserved Instances( elasticity is not required) provide most significant discount over Convertible Reserved Instances and Zonal Reserved Instances provide capacity reservation.

Convertible( If elasticity is required): These provide a lower discount than Standard Reserved Instances, but can be exchanged for another Convertible Reserved Instance with different instance attributes. Convertible Reserved Instances can also be modified.

Note: Spot fleet is a collection, or fleet, of Spot Instances, and optionally On-Demand Instances and is not suitable for long term, 24x7 workloads.

Refer AWS documentation — EC2 Reserved Instances

CloudFront provides a cost-effective solution to cache the static content and reduce the load on the origin servers

Refer AWS documentation — CloudFront

Let’s say An organization has 10 micro-services, each in an auto scaling group behind individual classic load balancers. Each EC2 instance is running at optimal load.

Replace the classic Load balancers with a single application load balancer.

Note: ALB is more suited for microservices architecture with the enhanced features to support content based routing. Replacing the multiple classic ELB with single ALB would help reduce cost without impacting performance.

Let’s say the EC2 Application needs to read write upto 3 TB of data to an external data store and requires read-after-write consistency across all AWS regions for writing new objects into this data store.

S3 provides the most cost-effective solution for storing large data, while providing read-after-write consistency across all AWS regions for writing new objects.

Note: EBS is not suitable for large data and EFS would not be the most cost-effective solution.

Glacier provides the most cost-effective archival solution. For normal requests, which default for standard retrieval, the videos can be retrieved within 3–5 hours.

For express retrieval, Expedited retrieval request can be made with additional charges for the video to be available in 1–5 minutes. For all but the largest archives (250MB+), data accessed using Expedited retrievals are typically made available within 1–5 minutes. There are two types of Expedited retrievals: On-Demand and Provisioned. On-Demand requests are like EC2 On-Demand instances and are available the vast majority of the time. Provisioned requests are guaranteed to be available when you need them.

Note: S3 Standard Infrequent Access is suitable for less frequently accessed data, which still needs to be access within an hour. Refer AWS documentation S3-IA

Let’s say company would like to query information coming from a particular sensor for the past week very rapidly, after which the data is infrequently accessed for another week. The data then needs to be archived. Using Amazon DynamoDB for its scalability and rapidity

Solution: Create tables for each week with the current week configured for higher throughput. Move the data to Glacier for archival and delete the old tables

Export the old table data from DynamoDB to Amazon S3 using AWS Data pipeline, and delete the old table.

Amazon Elastic Container Service for Kubernetes (Amazon EKS) is a managed service that makes it easy for you to run Kubernetes on AWS without needing to stand up or maintain your own Kubernetes control plane.

Refer AWS documentation — EKS

Your AWS environment contains several reserved EC2 instances dedicated to a project that has just been cancelled. Your supervisor would like to recuperate cost for these reserved instances, but also does not want to lose the data just yet in case the project is revived next fiscal year.

Take snapshots of the EBS volumes and terminate the instances

Sell the instances on the AWS Reserved Instance Marketplace

Note: Before you confirm your purchase, review the details of the Reserved Instances that you plan to buy, and make sure that all the parameters are accurate. After you purchase a Reserved Instance (either from a third-party seller in the Reserved Instance Marketplace or from AWS), you cannot cancel your purchase. However, you may be able to sell the Reserved Instance if your needs change. Refer AWS documentation — Reserved Instances Fundamentals

An application that uses EC2 instances and SQS to process requests from end users. Your application is working great, but your supervisor is concerned about the cost of the AWS resources it uses.

1)EC2 instance can be scaled based on the SQS queue demand to cut cost.

2)long polling only reduce the cost. Refer SQS Long Polling

3)Reducing the size of the SQS message to 60KB would help reduce cost

Refer AWS documentation — SQS Pricing

Note: Increasing the visibility timeout does not impact cost, but just makes the message unavailable for other customers for processing

Scheduled scaling is best suited to scale out before 9:00 a.m. and scale in after 9:30 a.m.

Refer AWS documentation — Auto Scaling Scheduled Scaling

The images will be retrieved infrequently, they must be available for retrieval immediately

S3 Standard Infrequent Access provides a cost effective solution for storage where the requirement for infrequent but immediate access to objects.

Note: Standard would work fine, but cost more as compared to S3 IA

An application that will run for eight hours, Monday through Friday. This application will also run a weekly batch process every Saturday night that consistently takes four hours to complete.

Scheduled Reserved Instances are suitable for workloads that do not run continuously but have regular schedule and you only pay for the time that the instances are scheduled.

Refer AWS documentation — EC2 Scheduled Reserved Instances

--

--