AWS Startups Blog

Extend Your Runway by Turning Off AWS Resources When Not in Use

by Guillermo Mansilla, AWS Solutions Architect, and Srijit Mitra, AWS Senior Startup Solutions Architect

Cost optimization is a priority for customers of all sizes, but particularly for early-stage startups. Founders want to make sure their financial resources are being used properly and they’re getting the most out of AWS.

Think of the last time you forgot to turn off the lights in an empty room; nobody needed the lights on, yet you ended up paying for it. This applies to your cloud resources as well. Fortunately, AWS empowers you to be in control of your spend by giving you not just full visibility on where your spend is going, but also the option to turn off resources when you don’t need them.

AWS offers more than 200 fully featured services on a pay-as-you-go pricing model. This means you pay only for the services you need, and once you stop using them, there are no additional costs or termination fees. This flexibility enables startups to experiment and bring products to market faster than ever before. And this agility does not have to come at the expense of increased costs.

Here are a few approaches that early stage startups can implement easily in order to get the most out of AWS in a cost-effective manner.

Tag your resources

You can assign metadata to your AWS resources in the form of tags. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources. AWS tags can be used for many purposes, but we will cover two of them: breaking down costs and setting up automation.

Let’s assume you are running two versions of your platform, alpha and beta. You can assign a tag with the key Version and value “alpha” to all your resources running the alpha version of your platform. Resources include AWS services like Elastic Load Balancing (ELB), Amazon Elastic Compute Cloud (Amazon EC2) instances, Amazon Relational Database Service (Amazon RDS) databases, Amazon Elastic Kubernetes Service (Amazon EKS) clusters, Amazon SageMaker notebooks and endpoints, AWS Lambda functions, etc. Similarly, for the resources running the beta platform, the Version tag will have the value “beta.”

1. Breaking down AWS costs

As an early stage startup, understanding your expenses in order to come up with a pricing model is a priority. AWS Cost Explorer allows you to filter your spend according to User-Defined Cost Allocation Tags. For tags to appear on your billing reports, you must activate your applied tags in the Billing and Cost Management console. It can take up to 24 hours for the tags to appear in the console. Follow the instructions here to activate the tags you created and applied to your resources. In the screenshot below, we are filtering all resources that have a project tag with the value “flask-api.” Breaking down costs in this manner helps you quickly validate pricing models as you test different prototypes.

2. Setting up automation

The AWS Instance Scheduler is an AWS solution that enables customers to configure custom start and stop schedules for their Amazon EC2 and Amazon RDS instances. The solution is easy to deploy and can help reduce operational costs for both development and production environments. Customers who use this solution to run instances during regular business hours can save up to 70% compared to running those instances 24 hours a day.

One thing to keep in mind when using the AWS Instance Scheduler is that you’ll be deploying infrastructure to manage infrastructure. The resources being deployed are all serverless and will scale down to zero when not in use, which is the best cost-optimization technique. We will talk about serverless and their main benefits in the next section. (If you don’t have previous experience with serverless, then this is a good opportunity for you to get started.)

The AWS Instance Scheduler also uses tags to filter which instances you want to control. During the initial configuration of the Instance Scheduler, you define a tag to identify the Amazon EC2 and Amazon RDS instances that you want to stop and start on a schedule you define. When you create a schedule, the name you specify is used as the tag value that identifies the schedule you want to apply to the tagged resource. For example, a user might use the solution’s default tag name “Schedule” and create a schedule called “uk-office-hours.” To identify an instance that will use the “uk-office-hours” schedule, the user adds the Schedule tag key with a value of “uk-office-hours.” Tags can be applied to multiple resources using the AWS Tag Editor.

Adopt serverless, managed services

So far we have shared some best practices to help you get the most out of AWS’ pay-as-you-go model by simply turning off unused resources. But what if there were services that didn’t even need to be turned off? AWS offers a suite of serverless, managed services whose pricing model is based on actual usage rather than run time. For example, say you are using an EC2 instance to host a Node.js RESTful API in production. You are being billed for this instance whether any requests are being served or not. That same web application can be hosted using Amazon API Gateway and an AWS Lambda function where you will only be billed per request. As an added bonus, the first million API calls made to a REST API on API Gateway are free every month. Now add on the benefits of a fully managed service (automated scaling, reduced operational overhead, etc.) and you are saving both time and money by letting AWS take care of the undifferentiated heavy lifting. Here is a step-by-step guide on setting up your first serverless application.

Conclusion

Tagging your resources will give you better visibility into your spend, and setting up automation makes it easy to turn off resources you are not using. Moreover, adopting serverless technologies can lower the cost of hosting your workloads—as well as the expenses incurred in time and effort of managing and maintaining resources.

This is by no means an exhaustive list. Rather, it’s just the starting point of the various cost-optimization options available on AWS. As your startup matures, we recommend you take a look at this article for additional ideas, and to keep your momentum going, consider applying for AWS Activate, a startup-focused program designed to accelerate long-term growth by issuing AWS credits and providing architecture guidance and access to subject-matter experts. These benefits are designed to give you the right mix of tools, resources, and expert support so that you can succeed with AWS while optimizing performance, managing risk, and keeping costs under control.

Have fun, and build on!


Guillermo Mansilla is a Solutions Architect based in Orlando, Florida. He has helped startups in the USA and Canada build and architect their applications on AWS. Before joining AWS, Guillermo spent over a decade working as a Software Developer. When he’s not at his desk, you can find him playing chess tournaments at his local chess club.

 

 

 

Srijit Mitra is a Sr. Startup Solutions Architect based in Toronto, Canada. He works with early stage and emerging startups to help bring their disruptive ideas to fruition. He has spent over a decade building and implementing DevOps practices at organizations of all sizes and transforming their software development practices.