<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: jonnym</title>
    <description>The latest articles on DEV Community by jonnym (@jonmelia).</description>
    <link>https://dev.to/jonmelia</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4228100%2F30452a1f-39d8-46da-a100-3f3a48ad6af1.jpg</url>
      <title>DEV Community: jonnym</title>
      <link>https://dev.to/jonmelia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonmelia"/>
    <language>en</language>
    <item>
      <title>How to find unused load balancers in AWS (every region, with the CLI)</title>
      <dc:creator>jonnym</dc:creator>
      <pubDate>Sat, 21 Nov 2026 09:09:56 +0000</pubDate>
      <link>https://dev.to/jonmelia/how-to-find-unused-load-balancers-in-aws-every-region-with-the-cli-13db</link>
      <guid>https://dev.to/jonmelia/how-to-find-unused-load-balancers-in-aws-every-region-with-the-cli-13db</guid>
      <description>&lt;p&gt;A load balancer charges for every hour it exists, whether or not anything uses it. When a project ends or a service moves, the load balancer in front of it is easy to forget. Here's how to find the idle ones and check they're safe to delete.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an unused one looks like
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No targets:&lt;/strong&gt; none of its target groups has a registered target, or it has none at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No traffic:&lt;/strong&gt; it has targets, but &lt;code&gt;RequestCount&lt;/code&gt; (ALB) or &lt;code&gt;NewFlowCount&lt;/code&gt; (NLB) has been empty for two weeks or a month.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classic Load Balancers with no instances.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One catch: load balancers only publish these metrics when there is traffic, so a quiet one often has &lt;em&gt;no data&lt;/em&gt; rather than zeros. And a redirect-only or fixed-response ALB has no targets but still answers requests, so check traffic before calling it idle.&lt;/p&gt;

&lt;h2&gt;
  
  
  List them and their targets
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws elbv2 describe-load-balancers \
  --query &lt;span class="s1"&gt;'LoadBalancers[].[LoadBalancerName,Type,CreatedTime,LoadBalancerArn]'&lt;/span&gt; --output table

aws elbv2 describe-target-groups --load-balancer-arn &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;load-balancer-arn&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  --query &lt;span class="s1"&gt;'TargetGroups[].TargetGroupArn'&lt;/span&gt; --output text

aws elbv2 describe-target-health --target-group-arn &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;target-group-arn&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  --query &lt;span class="s1"&gt;'TargetHealthDescriptions[].[Target.Id,TargetHealth.State]'&lt;/span&gt; --output table

aws elb describe-load-balancers \
  --query &lt;span class="s1"&gt;'LoadBalancerDescriptions[].[LoadBalancerName,length(Instances)]'&lt;/span&gt; --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run them in every enabled region: the console shows one region at a time, which is how forgotten load balancers stay forgotten.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the traffic
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws cloudwatch get-metric-statistics \
  --namespace AWS/ApplicationELB --metric-name RequestCount \
  --dimensions &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LoadBalancer,Value=app/staging-alb/09a43d9a32367c63 \
  --start-time &lt;span class="s2"&gt;"$(date -u -d '30 days ago' +%FT%TZ)"&lt;/span&gt; --end-time &lt;span class="s2"&gt;"$(date -u +%FT%TZ)"&lt;/span&gt; \
  --period 86400 --statistics Sum --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a Network Load Balancer use &lt;code&gt;--namespace AWS/NetworkELB --metric-name NewFlowCount&lt;/code&gt;. No datapoints means no traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you delete one
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Find who made it:&lt;/strong&gt; an &lt;code&gt;Owner&lt;/code&gt; tag, or its &lt;code&gt;CreateLoadBalancer&lt;/code&gt; event in CloudTrail (90 days).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check what points at it:&lt;/strong&gt; a Route 53 alias, a CNAME elsewhere, or a WAF web ACL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check Terraform or CloudFormation:&lt;/strong&gt; remove it there, or the next apply brings it back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check deletion protection:&lt;/strong&gt; if it's on, someone meant it. Ask first.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The full guide is at &lt;a href="https://getstrays.com/guides/unused-aws-load-balancers" rel="noopener noreferrer"&gt;getstrays.com/guides/unused-aws-load-balancers&lt;/a&gt;. &lt;a href="https://github.com/jonmelia/costwatch" rel="noopener noreferrer"&gt;costwatch&lt;/a&gt;, a free open-source scanner, finds them in every region in one command.&lt;/p&gt;

&lt;p&gt;Disclosure: I built Strays, a read-only tool that runs these checks every week and asks each owner whether to keep it.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>finops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Who created this AWS resource? Finding the owner with tags and CloudTrail</title>
      <dc:creator>jonnym</dc:creator>
      <pubDate>Sat, 21 Nov 2026 09:09:20 +0000</pubDate>
      <link>https://dev.to/jonmelia/who-created-this-aws-resource-finding-the-owner-with-tags-and-cloudtrail-50e8</link>
      <guid>https://dev.to/jonmelia/who-created-this-aws-resource-finding-the-owner-with-tags-and-cloudtrail-50e8</guid>
      <description>&lt;p&gt;Every AWS account has resources nobody remembers making. Before you delete one, or chase a security risk, you need to know who made it and whether they still need it. AWS records the answer in two places: tags, if someone added them, and CloudTrail.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Look at the tags
&lt;/h2&gt;

&lt;p&gt;If your team tags resources with &lt;code&gt;Owner&lt;/code&gt;, &lt;code&gt;CreatedBy&lt;/code&gt;, &lt;code&gt;Contact&lt;/code&gt; or &lt;code&gt;Team&lt;/code&gt;, that's the quickest answer. Tag Editor (in Resource Groups) searches every region at once. From the command line, this lists everything in a region with an &lt;code&gt;Owner&lt;/code&gt; tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws resourcegroupstaggingapi get-resources --tag-filters &lt;span class="nv"&gt;Key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Owner \
  --query &lt;span class="s1"&gt;'ResourceTagMappingList[].[ResourceARN,Tags[?Key==`Owner`].Value|[0]]'&lt;/span&gt; --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resources made by CloudFormation carry &lt;code&gt;aws:cloudformation:stack-name&lt;/code&gt;, which tells you which stack, and so usually which team.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Search CloudTrail for the create event
&lt;/h2&gt;

&lt;p&gt;CloudTrail's event history keeps the last 90 days of management events in each region, free and on in every account. Search it in the region the resource lives in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws cloudtrail lookup-events \
  --lookup-attributes &lt;span class="nv"&gt;AttributeKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ResourceName,AttributeValue=vol-0123456789abcdef0 \
  --query &lt;span class="s1"&gt;'Events[].[EventName,Username,EventTime]'&lt;/span&gt; --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look for the create event: &lt;code&gt;RunInstances&lt;/code&gt;, &lt;code&gt;CreateVolume&lt;/code&gt;, &lt;code&gt;CreateLoadBalancer&lt;/code&gt;, &lt;code&gt;CreateBucket&lt;/code&gt; and so on. Global services such as IAM log to us-east-1. The person shows up as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;An IAM user:&lt;/strong&gt; the user name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Identity Center (SSO):&lt;/strong&gt; an assumed role whose session name is their Identity Center user name, often their email address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A pipeline or service role:&lt;/strong&gt; the role name. Then the question is who runs that pipeline, and its commit history usually says.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Older than 90 days?
&lt;/h2&gt;

&lt;p&gt;If your organisation has a CloudTrail trail delivering to S3, the older events are there and Athena can search them. Without a trail, an untagged resource older than 90 days has no recorded creator. Then ask: post what it is, where it is and what it costs in your team's channel, and set a date after which it goes if nobody claims it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Make the next one easy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tag on creation:&lt;/strong&gt; &lt;code&gt;default_tags&lt;/code&gt; in the Terraform AWS provider, or tags on the CloudFormation stack.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Require the tag:&lt;/strong&gt; a tag policy in AWS Organizations, or the AWS Config rule &lt;code&gt;required-tags&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep a trail:&lt;/strong&gt; a CloudTrail trail to S3 means "who made this?" can always be answered.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The full guide is at &lt;a href="https://getstrays.com/guides/find-aws-resource-owner" rel="noopener noreferrer"&gt;getstrays.com/guides/find-aws-resource-owner&lt;/a&gt;. &lt;a href="https://github.com/jonmelia/costwatch" rel="noopener noreferrer"&gt;costwatch&lt;/a&gt;, a free open-source scanner, does the lookup for everything it finds with &lt;code&gt;--owners&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Disclosure: I built Strays, a read-only tool that does this every week and asks each owner in Slack or Teams.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>security</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Find unused AWS resources, and work out who made them</title>
      <dc:creator>jonnym</dc:creator>
      <pubDate>Thu, 05 Nov 2026 09:01:48 +0000</pubDate>
      <link>https://dev.to/jonmelia/find-unused-aws-resources-and-work-out-who-made-them-39em</link>
      <guid>https://dev.to/jonmelia/find-unused-aws-resources-and-work-out-who-made-them-39em</guid>
      <description>&lt;p&gt;Most AWS accounts are paying for things nobody uses any more. Each one is small, so nobody chases it. Finding them is the easy half. The hard half is knowing whether they're safe to delete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find them in every region
&lt;/h2&gt;

&lt;p&gt;The console shows one region at a time, and the forgotten things tend to be in the region nobody looks at. This lists unattached volumes in every enabled region:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;region &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;aws ec2 describe-regions &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'Regions[].RegionName'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; text&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$region&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  aws ec2 describe-volumes &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$region&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;status,Values&lt;span class="o"&gt;=&lt;/span&gt;available &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'Volumes[].[VolumeId,Size,CreateTime]'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; table
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same pattern works for Elastic IPs that aren't attached to anything:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ec2 describe-addresses &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'Addresses[?AssociationId==null].[PublicIp,AllocationId]'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And for log groups that never expire:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws logs describe-log-groups &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'logGroups[?!retentionInDays].[logGroupName,storedBytes]'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cost Explorer, Trusted Advisor and Compute Optimizer will also point you at likely waste. What they won't tell you is who made something, or whether it's still needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Find out who made it
&lt;/h2&gt;

&lt;p&gt;Deleting something because it looks unused is how outages happen. Start with tags, if you have them. If you don't, CloudTrail's event history keeps 90 days of management events in each region:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws cloudtrail lookup-events &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--lookup-attributes&lt;/span&gt; &lt;span class="nv"&gt;AttributeKey&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ResourceName,AttributeValue&lt;span class="o"&gt;=&lt;/span&gt;vol-0123456789abcdef0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'Events[].[EventName,Username,EventTime]'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the resource is in Terraform or CloudFormation, delete it there, not by hand, or it'll come back on the next apply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ask, then act
&lt;/h2&gt;

&lt;p&gt;Send the owner a short list: what it is, what it costs a month, and a choice to fix it, keep it, or snooze it. Write the answer down, so next month nobody has to ask about the same volume again.&lt;/p&gt;

&lt;p&gt;The full guide, with more places waste hides, is at &lt;a href="https://getstrays.com/guides/find-unused-aws-resources" rel="noopener noreferrer"&gt;getstrays.com/guides/find-unused-aws-resources&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Disclosure: I built Strays, a read-only tool that does this every week and asks the owners in Slack or Teams.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>finops</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
