DEV Track Spotlight: Optimize AWS Costs: Developer Tools and Techniques (DEV318)

Published: (December 27, 2025 at 12:55 PM EST)
8 min read
Source: Dev.to

Source: Dev.to

AWS re:Invent 2025 – “The Friday Morning Budget Alert”

Steph Gooch (Senior Solution Architect Advocate, AWS) & Kenneth Attard (AWS Community Hero & Enterprise Architect, Betsson Group)

Session Overview

As cloud applications grow in complexity, cost optimization becomes crucial. Steph and Kenneth explored AWS‑native tools and coding practices that reduce expenses without compromising performance or scalability.

Watch the full session:
[Insert video link]

1. The Friday Morning Budget Alert

Steph opened with a scenario every developer dreads:

“Imagine it’s Friday morning, you’ve had an easy week and you expect to sail through the day. Then you get an email – your AWS budget has been exceeded. It’s gone to you, your manager, your FinOps team… everyone is asking what happened.”

Goal: Never receive that email again by implementing proactive cost‑optimization strategies, leveraging AI tools, and preventing future waste.

2. Simple Optimizations – The Foundation

Kenneth shared real‑world optimizations from Betsson Group (a leading gaming company operating in 24 markets). Starting with a target of $100 K in savings, he walked through foundational actions:

AreaOptimizationImpact
CloudTrail ConsolidationConsolidate multiple trails into a single organization trail and delete the extras.Eliminates redundant logging costs.
EBS Volume CleanupDelete unattached volumes; retain snapshots only when required for compliance.Stops unnecessary storage charges.
Networking OptimizationRemove duplicate public‑facing ELBs (charges for both public IPs and the load balancer). Decommission unused NAT and transit gateways.Cuts double‑billing and idle‑gateway fees.
Right‑Sizing with GravitonMigrate EC2, RDS, and Lambda workloads to AWS Graviton (ARM‑based) instances.Improves cost efficiency and performance.
Storage OptimizationEnable S3 Intelligent‑Tiering; move infrequently accessed data to S3 Glacier. Migrate Intel‑based RDS instances to Graviton‑based ones.Reduces storage spend while maintaining access speed.

3. Leveraging AI for Cost Optimization

Steph demonstrated how AI tools can accelerate the optimization journey, focusing on Amazon Q Developer and Kiro CLI.

3.1 AWS Cost Optimization Hub

Cost Optimization Hub provides a single pane of glass for savings opportunities. It:

  • Categorizes savings by action type, account, region, and resource type.
  • Shows realistic, achievable savings (not inflated estimates).
  • Integrates with AWS Compute Optimizer for detailed, data‑backed recommendations.

3.2 Amazon Q Developer & Kiro CLI with MCPs

Model Context Protocol (MCP) servers let AI assistants connect directly to AWS services. Using Kiro CLI with MCPs, Steph showed how to:

  1. Query Cost Optimization Hub for compute recommendations.
  2. Identify specific resources to optimize.
  3. Automatically update infrastructure code (e.g., CloudFormation templates).
  4. Generate & execute AWS CLI commands for deployment.

“The time it takes to log into the console and see all of your savings in Cost Optimization Hub is very similar to using Kiro, finding the recommendation and making the change.”

AI tools therefore identify savings and help implement them faster.

3.3 Infrastructure Optimization with Amazon Q

Amazon Q Developer includes a built‑in optimization feature. When you select infrastructure code and click “Optimize,” it returns recommendations across three dimensions:

DimensionWhat’s evaluated
CostExpensive resources → cheaper alternatives
ArchitectureDesign patterns & service selection
SecurityPotential vulnerabilities

In the demo, Amazon Q analyzed a CloudFormation template, highlighted significant cost‑saving opportunities, and produced the updated template.

4. Advanced Optimizations – Deep Dives

4.1 Amazon CloudWatch Logs Optimization

Kenneth shared tactics to trim CloudWatch costs:

  • Delete unnecessary log groups and data.
  • Set appropriate retention periods (avoid “never expires”).
  • Optimize application code to reduce log volume.
  • Use CloudWatch Logs Infrequent Access for logs that are rarely queried.

4.2 AWS Config Optimization

For Amazon EKS clusters with auto‑scaling, continuous AWS Config recording generated excessive costs:

“We had Config enabled on EKS… continuous recording. During busy periods, EKS auto‑scaled and Config recorded a lot of changes.”

Solution: Switch from continuous to daily recording, dramatically lowering Config expenses.

4.3 Data Transfer Optimization

Data‑transfer charges can balloon quickly. Betsson applied several strategies:

StrategyHow it works
S3 Gateway EndpointsFree VPC endpoints keep S3 traffic inside the AWS network, avoiding NAT‑gateway data‑transfer fees.
Cross‑AZ Traffic ReductionDeploy NAT gateways in each Availability Zone; configure Kubernetes to keep traffic within the same AZ when possible.
Network ACLsBlock unwanted traffic at the subnet level, preventing unnecessary data‑processing charges.

5. Takeaways

  1. Start with the basics – consolidate logging, clean up unused resources, and right‑size workloads.
  2. Leverage Graviton for cost‑effective compute across EC2, RDS, and Lambda.
  3. Use AI assistants (Amazon Q, Kiro CLI) to surface and apply recommendations quickly.
  4. Fine‑tune observability and config services (CloudWatch, Config) to avoid hidden fees.
  5. Optimize data movement with VPC endpoints, AZ‑aware architecture, and network ACLs.

Implementing these practices helps you avoid the dreaded “Friday morning budget alert” and keeps your cloud spend aligned with business goals.

Key Components

(Add your component details here)

AWS Lambda Optimization

AWS Lambda cost optimization focuses on three key areas:

  1. Graviton Migration – Move Lambda functions to ARM‑based Graviton processors.
  2. Right‑Sizing – Adjust memory and CPU allocations after architectural changes to reduce compute costs.
  3. Code Optimization – Simplify function logic and reduce execution time.

Centralized NAT Gateway Architecture

Kenneth presented an advanced networking optimization: centralizing NAT gateways in a dedicated egress VPC connected via AWS Transit Gateway.

Cost comparison (3 VPCs, 2 TB data processed)

SetupMonthly Cost
Traditional$190 (3 NAT gateways)
Centralized$322 (3 NAT gateways + Transit Gateway attachments + processing)

“That is the cost savings, but it doesn’t apply for small setups.” – Kenneth

The breakeven point is 10 VPCs; beyond that, savings scale up to 8 % as more VPCs are added.

Key optimizations that made this work

  • Amazon S3 gateway endpoints – reduce traffic by 38.5 %–45 %
  • Network ACLs – block unwanted traffic at the source
  • Centralized management and monitoring

Regional Cost Optimization

Choosing the right AWS region can significantly impact costs. Kenneth shared a Database Migration Service (DMS) example:

Region (Instance: dms.c6g.6xlarge)Monthly Cost
Frankfurt (eu‑central‑1)$2,573
Ireland (eu‑west‑1)$2,300
N. Virginia (us‑east‑1)$1,619
São Paulo (sa‑east‑1)$4,057

Deploying the DMS instance in N. Virginia instead of São Paulo saved $2,438 per month. The same principle applies to many other services where regional pricing varies.

AWS WAF Cost Optimization

AWS WAF provides standard and premium features, each with a very different pricing model.

Standard Features (included in the base price)

  • Geoblocking rules
  • Core rule sets
  • Rate‑limiting rules
  • IP‑reputation lists

Premium Features (significantly more expensive)

  • Bot Control
  • Account‑creation fraud prevention
  • Account takeover prevention

“Use as much as possible the standard features like geoblocking rules, default rules, core rule sets, rate limiting, allow lists, block lists, IP reputation to minimize the traffic that is going to hit the premium features.” – Kenneth

CAPTCHA vs. Challenge

FeatureCostWhen to use
CAPTCHA$4 per 10 k requestsWhen you need explicit user interaction (e.g., to verify a human).
Silent Challenge$0.40 per million responsesWhen you can block or mitigate bots without showing a UI element.

Tip: If user interaction isn’t required, the silent Challenge can save > 99 % of the cost compared with CAPTCHA.

Web ACL Capacity Units (WCUs)

  • Standard allocation: 1,500 WCUs per Web ACL.
  • Cost‑effective scaling: Deploy WAF on Amazon CloudFront and on the downstream Application Load Balancer or API Gateway (each with its own WAF).
    • This effectively gives you 3,000 WCUs (1,500 + 1,500) without purchasing extra capacity.

Bottom line: Leverage as many standard features as possible, prefer silent challenges over CAPTCHAs, and use a layered WAF deployment (CloudFront + ALB/API Gateway) to double your WCU budget at no extra charge.

Preventing Future Waste

Service Control Policies (SCPs)

Steph introduced SCPs as preventative guardrails:

“They are a really good way of preventing potential waste before you even deploy into the cloud.”

SCPs set at the organization or OU level can stop costly mistakes:

GuardrailDescriptionExample
Instance‑type restrictionsBlock expensive instance families in development accounts; allow bypass roles for legitimate use cases.24xlarge, metal instances
Storage defaultsEnforce the use of gp3 volumes (≈ 20 % cheaper than gp2) for resources ≤ 1 TB.gp3 for EBS
NAT gateway controlsPrevent creation of NAT gateways in individual accounts when a centralized architecture is used.Disallow AWS::EC2::NatGateway in child accounts
Required taggingRequire tags needed for scheduling, automation, security, and compliance before resources can be created.Environment, Owner, CostCenter
Graviton enforcementDefault to Graviton‑based instance types for managed services, delivering ~10 % automatic savings.t4g.micro, m6g.large
Region restrictionsBlock deployments in expensive or unintended regions.Disallow us‑west‑1, ap‑south‑1

Steph demonstrated using Kiro CLI to:

  1. Create SCPs programmatically.
  2. Test infrastructure‑as‑code (IaC) against those policies before any real deployment.

This approach lets teams reap the benefits of SCPs—preventing waste—while still keeping the policies in dry‑run mode until they’re ready for production enforcement.

Context: Teaching AI Your Preferences

Both Amazon Q Developer and Kiro CLI support context files that store information about your preferences, projects, and best practices.

Amazon Q Developer

Steph created a rule specifying that Lambda functions should:

  • Use Graviton (ARM64 architecture)
  • Always include a CloudWatch log group
  • Set appropriate retention policies

With this context, a request like “create a simple test CloudFormation for Lambda” automatically generates optimized code.

Kiro CLI

Context files work similarly. Using context add to specify a file with optimization preferences ensures all generated infrastructure follows cost‑optimization best practices from the start.

“If you ever find yourself repeating conversations with AI, these are really handy to have.” – Steph

Key Takeaways

  • Work smarter, not harder – Use AI tools (Amazon Q Developer, Kiro CLI) together with MCPs to accelerate optimization implementation.
  • Optimize the low‑hanging fruit forever – Deploy Service Control Policies and context files to enforce best practices automatically.
  • Save time with COMsContext, Optimize, MCPs, and Save are the four elements that create a sustainable cost‑optimization practice.
  • Start small – Choose one optimization from the session and implement it; small wins build momentum for larger initiatives.
  • Data drives decisions – Leverage the AWS Cost Optimization Hub and AWS Compute Optimizer to understand the data behind recommendations before acting.

The Ultimate Goal

Steph concluded with the vision: a continuously optimized, waste‑free AWS environment where governance, automation, and AI work together to keep costs low and performance high.

“I want you to succeed. I want you to save all this money and I want you to reinvest it. I want you to reinvest it into new staff, into new certificates, into new resources, new features of your applications, whatever is gonna make your business better.”

Cost optimization isn’t about cutting corners. It’s about eliminating waste so you can invest in innovation, growth, and delivering value to customers.

About This Series

This post is part of DEV Track Spotlight, a series highlighting the incredible sessions from the AWS re:Invent 2025 Developer Community (DEV) track.

The DEV track featured 60 unique sessions delivered by 93 speakers from the AWS Community—including AWS Heroes, AWS Community Builders, and AWS User Group Leaders—alongside speakers from AWS and Amazon. These sessions covered cutting‑edge topics, including:

  • 🤖 GenAI & Agentic AI – Multi‑agent systems, Strands Agents SDK, Amazon Bedrock
  • 🛠️ Developer Tools – K
Back to Blog

Related posts

Read more »

Launch an AWS EC2 Instance

Introduction This guide walks you through launching an AWS EC2 instance, installing Docker, and running NGINX inside a Docker container. By the end you will ha...

CloudFront: Where You Lose Money

!Cover image for CloudFront: Where You Lose Moneyhttps://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-...