AWS Cost Optimizations
- Consider changing storage class of S3 objects from standard to standard-infrequent access. In total, there are four storage classes in S3, and selecting storage class appropriate to use-case can save costs. Changing storage class of stored objects can be achieved using S3 Life Cycle policies
- Consider reserving EC2 Instances. Cost savings are huge with reserved instances even when no upfront payments are made.
- Consider reserving RDS Instances. It can lower down costs significantly. Moreover, no upfront payments are required to reserve instances.
- If multiple web applications are deployed on multiple ec2 instance and every application is behind a Classic Load Balancer, then consider using Application Load Balancer instead. Application Load Balancer allows host-based routing. Single Application Load Balancer can be used to route traffic to different applications, and it will save costs significantly (since other load balancers can be removed now). Every web application can be part of different target group and different auto scaling policies can be applied to every target group.
- Select appropriate instance classes for EC2 and RDS. Run tests to determine how much resources (compute power and memory) you need for your application and then select appropriate instance class.
- DynamoDB read units are based on size of Item being read from table. For example, at the time of this writing, if you are reading one 12 KB item, then 3 read units will be consumed as one unit equals 4 KB. Similarly, if you are writing 12 Kb item then 12 units will be consumed because for writing one unit equals 1 Kb. This means, that if large items are being written then you need large read/write capacity to avoid throttling. An alternative approach is to only save metadata in DynamoDB and save rest of document/item in S3. Metadata in DynamoDB can refer to S3 Key. It will work if queries operate on metadata. Obviously, this solution will not work for every use-case, but a number of use cases can benefit from it. Use cases using dynamo db are more probable to benefit from this design because of the way local and global indexes work in Dynamo DB.
- Consider not using Multi-AZ option for RDS instances being used for dev/test purpose.
- If possible, consider moving some web-services to lambda. It can save huge costs as no need to run ec2 instance 24/7.