AWS billed resources pile up quickly when EC2 instances, S3 buckets, or Lambda functions sit idle. To cut costs, you must identify and stop unused services and delete the objects or resources they hold. Start by running the Cost Explorer report for the last 30 days, then filter for services with high spend but low usage, and finally terminate unused EC2 instances, delete empty S3 buckets, and remove unused Lambda functions and API Gateway stages.
How to Find Unused AWS Resources
You need to know what is costing money before you can stop it. AWS provides several built-in tools to help you spot idle resources. The most direct way is to use the Cost Explorer, which breaks down spending by service, region, and tag.
- Open the AWS Management Console and navigate to the Cost Explorer service.
- Select the 30 Days or Last 3 Months view.
- Choose Services from the dimension dropdown.
- Sort the list by Unblended Cost in descending order.
- Review the top spenders. Look for services that appear high in the list but have very little usage data or zero usage hours.
For EC2 instances, you can use the Instance Type dimension to see which instance sizes are most expensive. If a large instance type has very few running hours, it may be a candidate for downsizing or termination.
How to Clean Up EC2 Resources
EC2 instances are among the most common sources of unexpected charges. An instance left running overnight or during a weekend can cost tens of dollars. To clean up, you must terminate the instance and delete its associated resources.
How to Terminate an EC2 Instance
- Open the EC2 dashboard in the AWS Console.
- In the left navigation pane, choose Instances.
- Select the instance you want to terminate.
- Choose Instance state and then Terminate instance.
- Confirm the termination when prompted.
Termination is permanent. If you might need the instance again, create an AMI (Amazon Machine Image) first. An AMI saves the state of the instance as a template you can launch again later.
What Happens to the Volume and Security Groups?
Termination only stops the instance. The attached EBS volumes and security groups remain in your account. Volumes continue to incur charges until you explicitly delete them.
- Go back to the Instances page.
- Choose Volumes from the left pane.
- Find the volume that was attached to the terminated instance.
- Select the volume and choose Delete volume.
Security groups are more complex. They control network access for instances. If you delete a security group that is still attached to running instances, the instances will lose their network rules and may become unreachable. Only delete a security group if you are sure no other active resources are using it.
How to Delete Empty S3 Buckets
Storing objects in S3 incurs both storage and data transfer costs. Even an empty bucket can cost a small amount per month due to configuration fees. Deleting unused buckets is a safe and cost-effective step.
- Navigate to the S3 dashboard.
- Choose the bucket you want to delete.
- Go to the Permissions tab.
- Scroll to the Block public access (bucket settings) section.
- Ensure that Block all public access is turned on. If public access is enabled, the bucket will be blocked from deletion until you turn it off.
- Go to the Management tab and choose Delete bucket.
- Confirm the deletion by entering the bucket name.
Do not delete a bucket that contains data you need. If you want to save the data, download the objects to your local computer or another storage service before deleting the bucket.
How to Remove Unused Lambda Functions and API Gateways
Lambda functions and API Gateway stages also generate monthly charges. A Lambda function that is not invoked will still cost money for the time it is deployed. An API Gateway stage that is not used will charge for data processing and management.
How to Delete a Lambda Function
- Open the Lambda dashboard.
- Select the function you want to delete.
- Choose the Actions button in the top right corner.
- Choose Deploy and then Delete function.
When you delete a Lambda function, AWS also deletes the associated execution role and any permissions granted to it. Make sure no other services are using this role before you delete the function.
How to Delete an API Gateway Stage
- Open the API Gateway dashboard.
- Choose the API that contains the stage.
- Click on the stage name (for example,
prodordev). - Choose Stage in the left pane.
- Scroll to the bottom of the page and choose Actions.
- Choose Delete stage.
Deleting a stage removes the entire configuration for that version of the API. If other services are calling this stage, they will stop working. Always verify that no active applications are using the stage before you delete it.
How to Set Up CloudWatch Cost Alerts
Preventing future waste is easier when you are notified when costs start to rise. CloudWatch Alarms can send you an email or trigger an SNS topic when your estimated bill exceeds a threshold.
- Navigate to the CloudWatch console.
- Choose Alarms and then Create alarm.
- For the Statistic, choose Average.
- For the Period, choose 1 day.
- Set the Threshold to your monthly budget (for example, $50).
- Choose Notification and then Create an SNS topic if you do not have one.
- Enter your email address for the subscription.
- Choose Create alarm.
With this alarm in place, you will receive an alert if your spending approaches your budget limit. This gives you a chance to investigate and stop any unexpected usage before the bill grows larger.
What to Do When You Receive a Cost Alert
When you get an alert, do not panic. Follow these steps to investigate:
- Check the Cost Explorer for the last 24 hours to see which services are responsible for the increase.
- Review the EC2 console for instances running when they should not be.
- Look at the CloudTrail logs to see if there has been any unusual activity in your account.
How to Organize Resources with Tags
Tags are labels you add to resources to group them and track costs. By tagging resources with project names, environments, or owners, you can filter your cost reports and identify which teams or projects are using the most resources.
- Select a resource in the AWS Console (for example, an EC2 instance).
- Choose the Tags tab.
- Click Add tag.
- Enter a key (for example,
Project) and a value (for example,Website). - Repeat for other resources you want to track.
Once tags are in place, you can use them in the Cost Explorer. Filter by tag to see the cost for each project. This makes it easier to have a conversation with stakeholders about where to cut costs.
How to Apply Tags Automatically
Manually tagging every resource is time-consuming. You can automate this process using AWS Config rules or scripts. For example, you can create a rule that tags all new EC2 instances with the account owner’s email address.
How to Check Remaining Charges and Usage
At the end of the billing period, you should review your final bill to ensure that your cleanup efforts were effective. You can compare the current month’s spending to the previous month to see if you have reduced costs.
- Navigate to the Billing dashboard.
- Choose Billing and cost management and then Billing.
- Look at the Cost and usage reports section.
- Download the report for the current month.
- Open the report in a spreadsheet application.
- Compare the total cost to the previous month.
If you see a significant drop in spending, you have successfully decluttered your AWS resources. If spending remains high, return to the Cost Explorer and look for new sources of unexpected charges.
How to View Estimated Monthly Costs
AWS provides an estimate of your monthly costs based on your current usage. This estimate is updated daily and can help you spot unusual patterns before they become final charges.
- Open the Billing dashboard.
- Choose Billing and cost management and then Billing.
- Look at the Billing overview card.
- The estimate is displayed at the top of the page.
How to Check Unused IAM Users
IAM users are not charged for their existence, but they are charged for the permissions they use and the services they access. You should review IAM users periodically to ensure that only active users remain in your account.
- Open the IAM dashboard.
- Choose Users from the left pane.
- Review the list of users.
- For each user, check the Last used date.
- If a user has not been used in over 90 days and you do not need it, delete the user.
How to Review IAM Roles
IAM roles are similar to users but are assumed by services rather than people. You should review roles to ensure that they are not being used by services that no longer exist.
- Open the IAM dashboard.
- Choose Roles from the left pane.
- Review the list of roles.
- For each role, check the Trust policy to see which services can assume it.
- If a service is no longer in use, delete the role.
How to Delete Unused CloudFormation Stacks
CloudFormation stacks are sets of AWS resources defined by a template. If you no longer use a stack, you should delete it to avoid paying for its resources.
- Open the CloudFormation dashboard.
- Select the stack you want to delete.
- Choose Actions and then Delete stack.
- Confirm the deletion.
Deleting a stack removes all the resources it created. This is a fast way to clean up a whole set of resources at once.
How to Review AWS Budgets
AWS Budgets allows you to set spending limits and receive alerts when you approach them. You should review your budgets periodically to ensure they are still accurate.
- Open the Billing dashboard.
- Choose Budgets from the left pane.
- Review the list of budgets.
- If your spending has changed significantly, update your budgets accordingly.
How to Identify Orphaned Resources
Orphaned resources are resources that are not associated with any stack or tag. They can be difficult to find, but they can also be a significant source of waste.
- Use the Cost Explorer to filter for resources with high spend but no tags.
- Review the resources one by one to see if they are still needed.
- If they are not needed, delete them.
Related
- Declutter Kubernetes Resources Safely
- No Tools Prompts or Resources: What to Do
- Fact Sheet Natural Resources: What They Are and How to Use Them
General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more
Spotted an error? Tell us and we will correct it (corrections policy).