Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

AWS Logo
Menu

Detect and remediate cost waste | S02 E29 | Build On Weekly

This week, Rohini and Darko are joined by Steph, as we look at a way to detect potential unwanted costs and remediate them.We did this using AWS Config and some AWS Systems Manager magic

AWS Admin
Amazon Employee
Published Sep 21, 2023
Last Modified Jun 25, 2024
Image not found
This is what success looks like
It is very important to be aware of your costs when running workloads in the cloud. Do you know if you have any lingering resources (unused Elastic IPs, detached EBS volumes) that are causing you unwanted cots? 🤔 Well, today we have Steph joining us and demonstrating how we can fix all this using AWS Config and AWS Systems Manager Automation.
We ended up not being able to fix it on stream, BUT, Darko did spend some time and made it work at the end. And here is how it works now:

The fix

Alright, the issue we had is that we were not able to pass the SSM Automation document the correct parameters and execute the automation. After some time spent searching online and looking at other options in the SSM Automation documentation, we've realized that the solution is to use a different action type.
Instead of using aws:executeAwsApi, the better option was just to use aws:createTags, as that is what we actually wanted! 🥳 This simple change has made it possible to create a new automation document that has the following contents:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
description: |-
This automation document tags Unused Elastic IPs so we can track them.
schemaVersion: '0.3'
assumeRole: '{{AutomationAssumeRole}}'
parameters:
Resources:
type: StringList
description: (Required) The allocation IDs of the Elastic IP Addresses to be tagged.
AutomationAssumeRole:
type: String
description: The role that allows Automation to execute the actions on your behalf.
Tags:
type: MapList
description: 'Tags to apply to the elastic IP addresses. Enter in teh following format: {"Key":"COST_ALERT","Value":"UnusedEip"}'
mainSteps:
- name: 'TagElasticIP'
action: 'aws:createTags'
inputs:
ResourceType: EC2
Tags: '{{Tags}}'
ResourceIds: '{{Resources}}'
Then - to pass it the Tags parameter we use the following format: {"Key":"COST_ALERT","Value":"UnusedEip"}. Huzzah!
If you wish to see this in action, check out the addendum video here:
Check out the full stream recording here:
To view this Twitch stream, please accept cookies.

Links from today's episode

Reach out to the hosts and guests:

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments

Log in to comment