DEV Community

Sagar Trivedi
Sagar Trivedi

Posted on • Originally published at Medium

How to save cost in non-prod AWS environment

If you are in an organisation whose non-prod AWS environment costs are high and want to cut short on the cost without compromising on the development and deployment velocity, here is a short checklist/quick wins of actions that you can do in order to save money. Of Course you need to check whether the action has an impact on your environment or any process that they follow.

Use instance scheduler: There is this great solution on the AWS solution library. I highly recommend this. It stops and starts EC2 instances and RDS on a defined schedule. Use this to stop the environment when not in use. Instance Scheduler

Spot instances: If your application is stateless we can use spot instances or spot fargate in the environment to reduce the cost.

Single NAT gateway per VPC: NAT Gateways are costly and many IaaC by default create one NAT gateway per AZ which increases the costs. If it does not impact the working, you can create a single NAT gateway per VPC for your non prod environment. This will bring down a considerable amount of cost.

RDS IOPS instead of Storage: If your RDS storage requires IOPS, check if increasing the disk size meets your requirements. If your non-prod environment has reduced load, creating a RDS of 400GB is a great deal rather than creating a 100GB RDS with 1000 IOPS. (~$46 compared to ~$112)

Clean Up scripts: There should be an automation script which regularly detects and deletes unused AMI, EBS volumes, RDS snapshot etc. Storage Lifecycle manager is a great option to handle this. snapshot lifecycle

Schedule Scaling: If we are clear on the time when the environment usage will be high, We can increase or decrease the number of EC2/containers in the environment accordingly. S3 One Zone IA / S3 Intelligent Tier / LifeCycle Policy: This should not be needed always, S3 is dirt cheap, But if objects are accumulated over time, are huge, non-critical and rarely accessed, we can use these solutions accordingly.

Reseller: I do not know about other countries, But in India If we go for offline billing via a reseller of AWS we get a flat discount of 10% on the total monthly bill (Of course you need to commit a monthly amount and this may differ from customer to customer)

Reservation: If your future load is planned and have a clear requirement you can go for a savings plan or reservations.

To summarise, the above actions can help in reducing your non-prod AWS environment bills. Let me know what you think about it. Did any of these give you a TIL moment? Do you have something that is not listed here? Do you want me to cover more services? Do let me know.

Top comments (0)