Frequently Asked Questions

Amazon ECS Cost Optimization & Scheduled Shutdowns

Why should I consider scheduled shutdowns for Amazon ECS development environments?

Keeping Amazon ECS development and testing workloads running when not in use can lead to significant cloud expenses. Scheduled shutdowns automatically turn off resources during periods of inactivity (such as nights, weekends, or holidays), reducing costs, improving security by minimizing exposure, and supporting environmental sustainability through lower energy consumption. (Source: Sedai Blog, April 22, 2024)

How much can I save by implementing scheduled shutdowns for Amazon ECS?

By applying scheduled shutdowns and other engineering and financial optimizations, most ECS users can realize up to 40% cost savings for ECS services overall. (Source: Sedai Blog, April 22, 2024)

What are the main benefits of scheduled shutdowns for Amazon ECS?

Scheduled shutdowns offer cost reduction by turning off resources when not in use, enhance security by reducing the attack surface, and provide environmental benefits by lowering energy consumption and carbon emissions. (Source: Sedai Blog, April 22, 2024)

What are the four main methods to implement scheduled shutdowns for Amazon ECS?

The four main methods are: (1) Manual shutdowns, (2) CloudWatch Events with Lambda functions, (3) CloudFormation or Terraform templates, and (4) Schedules inside a platform such as Sedai. Each method offers different levels of automation, flexibility, and ease of use. (Source: Sedai Blog, April 22, 2024)

How do manual shutdowns for Amazon ECS work?

Manual shutdowns involve developers or administrators starting and stopping non-essential ECS services as needed. This method is straightforward, requires no additional setup, and offers flexibility, but relies on user discipline and can lead to forgotten resources and extra costs. (Source: Sedai Blog, April 22, 2024)

How can I automate scheduled shutdowns for Amazon ECS using Lambda and CloudWatch?

You can set up Lambda functions to start or stop ECS services based on custom schedules or events, using Amazon CloudWatch Events to trigger the functions. This approach allows for flexible, cost-effective automation tailored to your team's working hours. (Source: Sedai Blog, April 22, 2024)

What are the advantages of using CloudFormation or Terraform templates for ECS scheduled shutdowns?

Using Infrastructure as Code (IaC) tools like CloudFormation or Terraform enables automated, consistent, and scalable management of ECS resources, including provisioning, scaling, and teardown. This approach streamlines operations and supports version control. (Source: Sedai Blog, April 22, 2024)

How does Sedai help automate scheduled shutdowns for Amazon ECS?

Sedai allows you to set specific schedules for when ECS services should be shut down and restarted, automating cost savings and improving efficiency. You can easily define schedules at the account level, select clusters, and customize timing to match your team's working hours. (Source: Sedai Blog, April 22, 2024)

What steps are required to set up a scheduled shutdown in Sedai for Amazon ECS?

To set up a scheduled shutdown in Sedai: (1) Navigate to Settings > Schedules, (2) Under the Scale-down tab, click Create Schedule, (3) Name the schedule, (4) Select time zone, (5) Choose start time, duration, and days, (6) Select clusters to apply the schedule. Multiple clusters can be included in one schedule. (Source: Sedai Blog, April 22, 2024)

How do scheduled shutdowns support environmental sustainability?

By reducing the time cloud resources are running, scheduled shutdowns decrease energy consumption and lower carbon emissions, contributing to a more sustainable IT operation. (Source: Sedai Blog, April 22, 2024)

What are the risks of relying solely on manual shutdowns for ECS cost optimization?

Manual shutdowns depend on user discipline, and developers may forget to turn off resources, leading to unnecessary costs. Automated solutions help ensure resources are consistently managed according to schedule. (Source: Sedai Blog, April 22, 2024)

How can scheduled shutdowns be adjusted for variable developer working hours?

Schedules can be customized to account for late nights, weekend work, or holidays by adjusting the timing and days in your shutdown configuration, ensuring resources are available when needed and shut down during inactivity. (Source: Sedai Blog, April 22, 2024)

What should I consider when using Lambda functions for ECS scheduled shutdowns?

When using Lambda functions, ensure you have the correct IAM permissions, adjust for time zones (CloudWatch uses UTC), and remember that stopping ECS tasks does not stop underlying EC2 instances, which may still incur costs. (Source: Sedai Blog, April 22, 2024)

Can I manage multiple ECS clusters with a single schedule in Sedai?

Yes, Sedai allows you to include multiple ECS clusters in a single schedule, making it easy to manage cost optimization across your development environments. (Source: Sedai Blog, April 22, 2024)

What are the environmental and security benefits of scheduled shutdowns?

Scheduled shutdowns reduce energy consumption and carbon emissions, supporting sustainability goals. They also decrease the attack surface by minimizing the time resources are exposed to potential threats. (Source: Sedai Blog, April 22, 2024)

Where can I find more strategies for optimizing ECS costs?

You can find additional strategies for optimizing ECS costs in Sedai's blog post "7 Strategies to Optimize ECS Costs" and on the Sedai platform's AWS ECS cost optimization page. (Source: Sedai Blog, April 22, 2024)

How does Sedai's scheduled shutdown feature compare to manual or Lambda-based solutions?

Sedai's scheduled shutdown feature offers a user-friendly, automated approach that reduces manual effort and risk of forgotten resources. Unlike manual or Lambda-based solutions, Sedai provides centralized scheduling, multi-cluster management, and integration with other optimization features. (Source: Sedai Blog, April 22, 2024)

What is the impact of scheduled shutdowns on ECS development and testing environments?

Scheduled shutdowns help control costs, improve security, and support sustainability without impacting productivity, as resources are available during active development hours and shut down during inactivity. (Source: Sedai Blog, April 22, 2024)

How do I get started with Sedai's scheduled shutdowns for ECS?

Sign up for a Sedai account, navigate to the Schedules section, and follow the guided steps to create and apply a shutdown schedule to your ECS clusters. For more details, refer to Sedai's documentation and support resources. (Source: Sedai Blog, April 22, 2024)

Features & Capabilities

What features does Sedai offer for cloud cost optimization?

Sedai provides autonomous cloud optimization, scheduled shutdowns, rightsizing, and waste elimination, reducing cloud costs by up to 50%. It supports compute, storage, and data optimization across AWS, Azure, GCP, and Kubernetes. (Source: Sedai Solution Briefs)

Does Sedai support integration with Infrastructure as Code tools?

Yes, Sedai integrates with Infrastructure as Code (IaC) tools such as Terraform, as well as CI/CD platforms like GitLab, GitHub, and Bitbucket, enabling seamless workflow automation. (Source: Sedai Technology Overview)

What monitoring and notification tools does Sedai integrate with?

Sedai integrates with monitoring and APM tools like CloudWatch, Prometheus, Datadog, and Azure Monitor, as well as notification tools such as Slack and Microsoft Teams. (Source: Sedai Technology Overview)

What modes of operation does Sedai offer?

Sedai offers Datapilot (observability), Copilot (one-click optimizations), and Autopilot (fully autonomous execution), providing flexibility for different operational needs. (Source: Sedai Solution Briefs)

How does Sedai ensure safe and auditable changes in cloud environments?

Sedai integrates with IT Service Management (ITSM) tools like ServiceNow and Jira, and supports enterprise-grade governance, ensuring all changes are safe, validated, and auditable. (Source: Sedai Solution Briefs)

What security and compliance certifications does Sedai have?

Sedai is SOC 2 certified, demonstrating adherence to stringent security and compliance standards for data protection. (Source: Sedai Security Page)

How quickly can Sedai be implemented?

Sedai's setup process takes just 5 minutes for general use cases and up to 15 minutes for specific scenarios like AWS Lambda, with agentless integration and comprehensive onboarding support. (Source: Sedai Get Started Page)

What technical documentation is available for Sedai?

Sedai provides detailed technical documentation, including setup guides, feature explanations, and troubleshooting resources, available at docs.sedai.io/get-started. (Source: Sedai Documentation)

Use Cases & Business Impact

What business impact can I expect from using Sedai?

Customers can achieve up to 50% cloud cost savings, 75% latency reduction, and 6X productivity gains. For example, Palo Alto Networks saved $3.5 million, and KnowBe4 achieved 50% cost savings in production. (Source: Sedai Solution Briefs)

Who are some of Sedai's notable customers?

Sedai's customers include Palo Alto Networks, HP, Experian, KnowBe4, Expedia, CapitalOne Bank, GSK, and Avis, representing industries such as cybersecurity, IT, financial services, healthcare, travel, and more. (Source: Sedai Customer Logos)

What industries does Sedai serve?

Sedai serves industries including cybersecurity, IT, financial services, security awareness training, travel, healthcare, car rental, retail, SaaS, and digital commerce. (Source: Sedai Case Studies)

Who is the target audience for Sedai?

Sedai is designed for platform engineers, IT/cloud ops, technology leaders, site reliability engineers (SREs), and FinOps professionals in organizations with significant cloud operations. (Source: Sedai Buyer Personas)

What pain points does Sedai address for cloud teams?

Sedai addresses pain points such as cost inefficiencies, operational toil, performance and latency issues, lack of proactive issue resolution, complexity in multi-cloud environments, and misaligned priorities between engineering and FinOps. (Source: Sedai Buyer Personas)

Can you share a customer success story related to cost optimization?

KnowBe4 achieved up to 50% cost savings in production and saved $1.2 million on their AWS bill using Sedai, despite rapid growth. (Source: KnowBe4 Case Study)

How does Sedai help with performance improvements?

Sedai reduces latency by up to 75%. For example, Belcorp achieved a 77% reduction in AWS Lambda latency, and Campspot saw a 34% reduction, significantly improving user experience. (Source: Sedai Solution Briefs)

What productivity gains can be expected with Sedai?

Sedai automates routine tasks, delivering up to 6X productivity gains. For instance, Palo Alto Networks performed over 2 million autonomous remediations in one year. (Source: Sedai Solution Briefs)

How does Sedai improve release quality?

Sedai's Release Intelligence tracks changes in cost, latency, and errors for each deployment, ensuring smoother releases and minimizing risks. Companies like Freshworks have benefited from this feature. (Source: Sedai Solution Briefs)

Competition & Differentiation

How does Sedai differ from other cloud optimization tools?

Sedai offers 100% autonomous optimization, proactive issue resolution, application-aware intelligence, and full-stack cloud coverage, setting it apart from competitors that rely on manual adjustments or focus on specific areas. (Source: Sedai Solution Briefs)

What unique features does Sedai provide for ECS cost optimization?

Sedai provides automated scheduled shutdowns, centralized multi-cluster management, and integration with other optimization features, making ECS cost optimization simple and effective. (Source: Sedai Blog, April 22, 2024)

Why choose Sedai over manual or script-based ECS shutdown solutions?

Sedai reduces manual effort, risk of forgotten resources, and complexity by providing a user-friendly interface, centralized scheduling, and integration with other cloud optimization features. (Source: Sedai Blog, April 22, 2024)

What advantages does Sedai offer for different user segments?

Platform engineers benefit from reduced toil and IaC consistency; IT/cloud ops see lower ticket volumes and safer automation; technology leaders gain measurable ROI and cost savings; FinOps teams align engineering and cost goals; SREs experience fewer alerts and automated scaling. (Source: Sedai Buyer Personas)

Sedai Logo

Using Scheduled Shutdowns to Optimize Amazon ECS Development Costs

AJ

Aby Jacob

VP of Engineering

April 22, 2024

Using Scheduled Shutdowns to Optimize Amazon ECS Development Costs

Featured

Summary

  • Keeping Amazon ECS development & testing environments workloads running when they're not actively used can lead to considerable expenses for teams.
  • Implementing scheduled shutdowns of Amazon ECS cloud resources when not in use can lead to cloud cost savings with relatively little implementation effort.
  • Four ways to achieve shutdowns for Amazon ECS include (1) manual shutdowns, (2) Lambda functions, (3) Cloudwatch templates and (4) schedules inside a platform such as Sedai.

Introduction

Engineering teams are looking for ways to be more cost-efficient, especially with the growth of the FinOps function. We project that the majority of ECS users can realize a 40% cost saving for ECS services overall by applying multiple engineering and financial optimizations including the scheduled shutdown tactic discussed below.  Development environments can make up a significant portion of overall cloud expenses, particularly during extensive testing processes, and are a candidate for optimization.

Teams using Amazon ECS typically run some ECS services in development environments in order to develop or test planned releases. Teams may run a small number of tasks on a continuous basis for functionality testing and there is a risk these environments are left running. Other types of testing that involve high resource intensity, such as performance, security, resilience and recovery, and volume testing, could also impose significant costs.

Scheduled shutdowns automatically turn off resources during periods of inactivity, typically nights, weekends, or holidays. The benefits of scheduled shutdowns are:

  • Cost Reduction: Turning off resources when not in use can lead to significant savings.
  • Security: Decreases the attack surface by minimizing the time resources are exposed to potential threats.
  • Environmental Benefits: Less energy consumption translates to reduced carbon emissions.

We’ll then cover four methods to implement scheduled shutdowns. I would also like to thank my colleagues Benji Thomas and S. Meenakshi for their technical input.

Run when Developers are active

Developers typically work 5 days a week. According to Stack Overflow’s Developer Survey, three quarters work less than 45 hours per week. Below is a heat map of developer working hours across multiple weeks at Ximes, a software company.

6626852d9a1c5bad21520793_T03qrAHWsqIfU0d1CW02XtaLlKkvo0f-KP4rye3A4mgzNWq_E7Hrmpyfc16SkAIkBLAnfidv2mmFQdPPKKJB79vwLoyc6IY02VvGxv-z92MQlMsl4hsJ0PzydBreF3N1XqPl_cPIM6h5bwk_lFWhSnQ.webp

In this company, while a 5 day working pattern is standard, there are some late nights, occasional Saturday working time and public holidays. Some adjustments to scheduled shutdowns to support variability in working hours will be needed.

Four Options to Achieve Scheduled Shutdowns in Amazon ECS

Let’s review four ways to achieve scheduled shutdowns:

  1. Manual Shutdowns
  2. Cloudwatch Events with Lambda Functions
  3. CloudFormation or Terraform Templates
  4. Sedai Schedules for Amazon ECS

1. Manual Shutdowns for Amazon ECS

Manual intervention involves developers and administrators manually starting and stopping non-essential services as needed. This method is the most straightforward and requires no additional setup or automation. Developers may forget to turn off resources when they are not being used, which can lead to extra costs."

Advantages:

  • Low Effort to Implement: Requires no setup beyond existing processes.
  • Flexibility allows you to start or stop at any time, providing immediate control over resources.
  • No Costs: Involves no additional costs for automation tools or services.

2. Scheduled Shutdowns for Amazon ECS with Cloudwatch and Lambda

Lambda-based solutions can automate the starting or stopping of ECS services based on custom schedules (e.g., weekday working hours) or events, offering flexibility in resource management.

Advantages:

  • Customization: Tailors the control of Amazon ECS resources based on specific operational needs.
  • Cost-Effective: Optimizes costs by adjusting resources in response to actual demand.
  • Integration: Works well with ECS and other AWS services for comprehensive management.

Creating a scheduled startup and shutdown for an Amazon ECS cluster involves setting up a Lambda function to either start or stop the cluster and scheduling that Lambda function to run at specific times using Amazon CloudWatch Events. Below is an outline of the steps required and the code to implement this:

Step 1: Create the Lambda Function

Below is a Python script you can use in your Lambda function. This script assumes you have an Amazon ECS cluster and service you want to manage. It checks whether the event it receives is for a startup or a shutdown and sets the desired count accordingly.

Replace 'your_cluster_name' and 'your_service_name' with the actual names of your Amazon ECS cluster and service. Ensure your Lambda function has the necessary IAM permissions to modify Amazon ECS services.

Note that setting the desiredCount to 0 will stop all running tasks, but it does not manage the underlying EC2 instances themselves. So we need EC2 scale in scale out parameters managed explicitly.  If the EC2 was provisioned manually then we need to stop the instance for cost savings to occur.  You will also still be charged for the  associated attached EBS cost.

Step 2: Schedule the Lambda Function Using CloudWatch Events

For Startup:

  • Open the Amazon CloudWatch console.
  • In the navigation pane, choose Events > Rules.
  • Choose Create rule.
  • For Event Source, choose Schedule and use the cron expression 0 8 ? * MON-FRI * to trigger at 8 AM, Monday through Friday.
  • For Targets, choose Add target, then select your Lambda function.
  • Configure input as Constant (JSON text) and provide {"action": "start"}.
  • Give your rule a name and description. Ensure the state is Enabled.
  • Choose Create rule.

For Shutdown:

  • Repeat the steps for the startup schedule, but change the cron expression to 0 19 ? * MON-FRI * to trigger at 7 PM, and use the JSON input {"action": "stop"}.

This setup ensures your ECS service starts at 8 AM and stops at 7 PM on weekdays, managing resources efficiently and cutting unnecessary costs.  Note that Amazon CloudWatch uses UTC time for all schedules, so you'll need to adjust to your local timezone and factor in daylight saving time.

3. Scheduled Shutdowns for Amazon ECS with CloudFormation Templates

We can also implement an Infrastructure as Code approach to manage the provisioning, scaling, and teardown of Amazon ECS resources, enabling dynamic environment management.   We can convert the steps needed to configure Lambda functions and CloudWatch events into CloudFormation templates.

Advantages:

  • Automation: Streamlines the creation and destruction of resources.
  • Consistency: Ensures environments are consistently deployed and managed.
  • Scalability: Facilitates easy scaling and version control of Amazon ECS configurations.

4. Sedai Scheduled Shutdown for Amazon ECS Clusters

With Sedai, you can set specific schedules for when services should be shut down and restarted, with little effort helping to reduce costs and improve overall efficiency.

Advantages:

  • Automated Cost Savings: Reduces cloud costs by scaling services according to demand.
  • Ease of Use: Provides a simple approach to managing scheduled shutdowns.

Below is an example of a Sedai schedule to run Amazon ECS clusters at the account level from 8am-6pm five days a week in Sedai.

6626852dc30219341b57cca5_RXlnwyXBQlGulqDUXj-RSSCfvkUuRuhZZoDrLOEN2y7VFZMDN_JMaOQb94RZvdGyOiw-EK16-hS9Z4w7pW0HaGFrjyIS1g2pL0Uh_GxobDTKQxJuUR_EZ5YhWMiMMYSxU9OcVhV1fJNo1ZupeKGm0WY.webp

To define a scale-down schedule inside Sedai, follow these steps inside your Sedai account:

  1. Navigate to Settings > Schedules
  2. Under the Scale-down tab, click Create Schedule
  3. Give the schedule a name
  4. Select time zone
  5. Choose a start time, duration, and the days when the schedule should run
  6. Select which clusters the schedules should apply to. (Note: you can include multiple clusters in one schedule)

By following these simple steps within your Sedai account, you can easily set up a schedule to run your ECS clusters only during specific hours and days, helping you to optimize your cloud costs. This automated cost savings feature is just one of the many benefits of using Sedai for managing your container lifecycles.

Conclusion

In conclusion, scheduled shutdowns in Amazon ECS development environments are an effective strategy for optimizing cloud expenses as well as enhancing security and supporting environmental sustainability.

Whether through manual interventions, which rely on user discipline, automated Lambda functions, CloudFormation templates for scalable infrastructure management, or Sedai's user-friendly scheduling tools, each method offers unique benefits.

We hope that you find one of these solutions beneficial in terms of Amazon ECS cost savings in your development environment. If you have any comments or suggestions about the solution, don't hesitate to reach out to us.