Managing AWS Costs with Your Grumpy but Friendly Assistant Clio

Aug 12, 2024 by Bill Maxwell
Managing AWS Costs with Your Grumpy but Friendly Assistant Clio

Managing AWS Costs with Your Grumpy but Friendly Assistant Clio

If you haven't met Clio, your slightly grumpy but friendly assistant designed to help you with DevOps-related tasks using CLI programs, I'd like to introduce you now. Clio is a powerful tool that can assist you with managing a wide range of CLI based tasks. Clio can interact with cloud providers, Kubernetes, Docker, Multipass, GitHub or GitLab, including AWS cost management. In this post, we'll explore how Clio can help you analyze your AWS Spending, set up budgets and alerts, identify unused resources, optimize configurations, and more.

When using AWS, even for small projects, resource usage can drive up costs. Once you have users of your application network costs quickly come into play. It is best to get a handle on your cloud spend early on to help make informed decisions and avoid any surprises. Using Clio you can gain visibility and find unused resources, inefficient configurations that can lead to unexpected costs.

How Clio Can Assist with AWS Cost Management

Clio's AWS agent is equipped with tools and commands to help you monitor, analyze, and optimize your AWS costs. Here are some ways Clio can assist you:

  1. Understanding Your Spending: If you want to understand where your money is going, just ask Clio. For example, you might say, "Clio, show me a breakdown of my AWS costs for the last month." Clio will then retrieve and present a detailed cost and usage report, helping you identify the most expensive services and resources. You can drill down into each spending category to get a better understanding of your costs.

  2. Setting Up Budgets and Alerts: To avoid unexpected costs, you can ask Clio to help you set up budgets and alerts. For instance, you might say, "Clio, help me set a monthly budget of $1000 and alert me when I reach 80% of it." Clio will guide you through the process of creating a budget and configuring alerts. The mechanism used involves creating a budget in AWS and setting up notifications to alert you when your spending reaches certain thresholds.

  3. Identifying Unused Resources: If you're concerned about paying for resources you don't use, you can ask Clio, "Clio, find any unused or underutilized resources in my AWS account." Clio will scan your account and provide a list of resources that can be terminated or optimized to save costs.

  4. Optimizing Resource Configurations: To ensure you're using your resources efficiently, you can ask Clio for recommendations. For example, "Clio, how can I optimize my EC2 instances to reduce costs?" Clio will analyze your current configurations and suggest changes such as resizing instances, using reserved instances, or leveraging spot instances.

  5. Analyzing Cost Trends: To get a clear picture of your spending over time, you can ask Clio, "Clio, show me the cost trends for the past six months." Clio will generate a report that highlights your spending patterns, helping you make informed decisions about resource allocation and budgeting.

Installing Clio

If you want to follow along with the examples in this post, you will need to first install Clio command line tool. On a Mac, you can simply run:

brew install gptscript-ai/tap/clio

Or to see how to build Clio for your platform you can find additional info in the docs.

Digging Deeper into Your AWS Spending

Clio can help you dig deeper into your AWS spending to uncover hidden costs and optimize your budget. Here are some ways Clio can assist:

  1. Detailed Cost Breakdown: If you need a detailed breakdown of your costs, you can ask Clio, "Clio, show me the detailed cost breakdown for my AWS services." Clio will provide a comprehensive report that includes costs for each service, region, and resource type, helping you identify the most expensive areas.
> Can you get that but omit $0.00 items/regions Here is the breakdown of the AWS bill for last month (June 2024) by service and region, omitting items with $0.00 cost: ### By Service and Region: • AWS Cost Explorer • us-east-1: $0.21 • AWS Key Management Service • us-east-2: $4.00 • AWS Secrets Manager • ap-northeast-1: $0.00003 • ap-northeast-2: $0.000025 • ap-northeast-3: $0.00003 • ap-south-1: $0.00003 • ap-southeast-1: $0.000025 • ap-southeast-2: $0.00003 • ca-central-1: $0.00003 • eu-central-1: $0.00003 • eu-north-1: $0.000025 • eu-west-1: $0.00003 • eu-west-2: $0.00003 • eu-west-3: $0.00003 • sa-east-1: $0.00003 • us-east-1: $0.00003 • us-east-2: $0.000035 • us-west-1: $0.00003 • us-west-2: $0.00003 • Amazon EC2 Container Registry (ECR) • us-east-2: $0.05380884 • EC2 - Other • us-east-1: $26.40 • us-east-2: $5.08 • us-west-1: $2.69 • Amazon Elastic Compute Cloud - Compute • us-east-1: $8.35 • us-east-2: $2.32 • us-west-1: $9.94 • Amazon Elastic Container Service for Kubernetes • us-east-2: $5.45 • Amazon Elastic File System • us-east-1: $0.0017583216 • Amazon Elastic Load Balancing • us-east-2: $1.35 • Amazon SageMaker • us-east-1: $35.99 • Amazon Simple Storage Service • eu-north-1: $0.001101264 • us-east-1: $0.0011277229 • us-east-2: $0.2575329563 • us-west-1: $8.606109615 • us-west-2: $0.000116304 • Amazon Virtual Private Cloud • us-east-1: $3.60 • us-east-2: $1.098629165 • us-west-1: $3.60 • AmazonCloudWatch • eu-north-1: $0.000010197 • us-east-2: $0.3669833808 • us-west-2: $0.016059333 If you need further details or have any other questions, feel free to ask! > What were the EC2 - Other costs in us-east-1 The "EC2 - Other" costs in the us-east-1 region for last month (June 2024) were $26.40 USD. Would you like more details on what constitutes "EC2 - Other" costs, or is there anything else you need? > yes "EC2 - Other" costs typically include charges for various EC2-related services that are not directly associated with running EC2 instances. These can include: 1. Elastic IP Addresses: Charges for Elastic IP addresses that are not associated with a running instance. 2. EBS Volumes: Costs for Elastic Block Store (EBS) volumes, including provisioned storage, I/O requests, and snapshots. 3. Data Transfer: Charges for data transfer between regions, availability zones, or out to the internet. 4. Load Balancers: Costs associated with using Elastic Load Balancers (ELB). 5. NAT Gateways: Charges for using NAT Gateways. 6. Elastic GPUs: Costs for using Elastic GPUs with your EC2 instances. 7. EC2 Auto Scaling: Charges related to EC2 Auto Scaling. 8. EC2 Fleet: Costs associated with using EC2 Fleet to manage multiple EC2 instances. 9. Savings Plans and Reserved Instances: Any amortized costs or savings from Savings Plans and Reserved Instances. To get a more detailed breakdown of the "EC2 - Other" costs, we can query the AWS Cost Explorer for specific usage types within the "EC2 - Other" category. Would you like me to proceed with that? > yes Here is the detailed breakdown of the "EC2 - Other" costs in the us-east-1 region for last month (June 2024): ### EC2 - Other Costs in us-east-1: • Data Transfer • DataTransfer-Regional-Bytes: $0.0000004473 • USE1-APN2-AWS-Out-Bytes: $0.0000000929 • USE1-APS2-AWS-Out-Bytes: $0.0000000464 • USE1-APS3-AWS-Out-Bytes: $0.0000015816 • USE1-EU-AWS-Out-Bytes: $0.0000034686 • USE1-EUW2-AWS-Out-Bytes: $0.0000000046 • USE1-USE2-AWS-Out-Bytes: $0.0000000244 • USE1-USW2-AWS-Out-Bytes: $0.0000002944 • EBS Volumes • EBS:VolumeUsage.gp2: $0.799999992 • EBS:VolumeUsage.gp3: $25.59999996 The majority of the costs are associated with EBS volumes, specifically gp2 and gp3 volume usage. If you need further details or have any other questions, feel free to ask!

Notice that you can discuss with Clio to get more details, and that Clio always suggests a possible next step.

  1. Identifying Cost Anomalies: If you notice unexpected charges, you can ask Clio, "Clio, identify any cost anomalies in my AWS account." Clio will analyze your spending patterns and highlight any unusual or unexpected costs, helping you take corrective action.

  2. Comparing Costs Over Time: To see how your spending has changed, you can ask Clio, "Clio, compare my AWS costs for the last six months." Clio will generate a comparison report that shows cost trends and highlights any significant changes.

> can you show me the last 6 months of billing by month? Here are the AWS billing details for the last 6 months: • January 2024: $4800.86 USD • February 2024: $2202.31 USD • March 2024: $157.23 USD • April 2024: $147.28 USD • May 2024: $122.52 USD • June 2024: $119.39 USD Is there anything else you would like to know or do? >
  1. Forecasting Future Costs: To plan for future expenses, you can ask Clio, "Clio, forecast my AWS costs for the next quarter." Clio will use historical data to predict future spending, helping you budget more effectively.
> determine the projected costs over the next quarter Here are the projected costs over the next quarter: • July 2024: $156.84 USD • August 2024: $506.65 USD • September 2024: $836.07 USD The total projected cost for the next quarter is approximately $1499.56 USD. Is there anything else you would like to know or do? >
  1. Create a Budget and Alerts: You might start by saying, "Clio, I want to set a monthly budget of $1000 for my AWS account." Clio will guide you through the process of creating the budget. You can then say, "Clio, alert me when my spending reaches 80% and 100% of my budget." Clio will help you configure the necessary alerts to keep you informed.
> I want to create a $1000 budget called clio-demo. It should alert at 80 and 100%. It should send to no-reply[@]acorn.io The monthly budget named "clio-demo" with a limit of $1000 has been successfully created. Alerts will be sent to no-reply[@]acorn.io at 80% and 100% of the budget. Is there anything else you would like to do? >
  1. Monitor Spending: To keep track of your spending, you can periodically ask, "Clio, show me my current AWS spending." Clio will retrieve the latest cost and usage report for you.
> What is my current AWS Spending for the month? Your current AWS spending for the month of July 2024 is approximately $138.62 USD. This amount is estimated as the month is still ongoing. Is there anything else you would like to know or do?

Wrapping up

Clio is here to help you manage your AWS costs effectively. By leveraging Clio's capabilities, you can gain better visibility into your spending, set up budgets and alerts, identify cost-saving opportunities, and optimize your resource configurations. This ensures that you get the most value out of your AWS investment without breaking the bank. We are just scratching the surface of what is going to be possible with Clio and AI. You can imagine having alerts run Clio scripts that will automatically take a look at the environment and quickly provide insights and recommendations.

For more information and to get started, visit Clio's GitHub repository.