Salta al contenuto

Can I schedule an automatic shutdown for an EC2 instance every night?

0

Can I schedule an automatic shutdown for an EC2 instance every night? I want to save money by shutting down a dev instance at midnight every day. Is there a built-in AWS method for doing this automatically?

1 Risposta
1
Risposta accettata

Yes, you can schedule an automatic shutdown for your EC2 instance every night at midnight to save costs on your development instance. AWS offers several built-in methods to accomplish this:

  1. AWS Systems Manager Resource Scheduler (Quick Setup):
  • Open the AWS Systems Manager console
  • Navigate to Quick Setup
  • Select the Resource Scheduler card and choose Create
  • Specify the tag key and value for your EC2 instance
  • Configure the schedule to stop your instance at midnight
  1. Amazon EventBridge with AWS Lambda:
  • Create a Lambda function that stops EC2 instances
  • Set up an EventBridge schedule with a cron expression (e.g., "0 0 * * ? *" for midnight every day)
  • Configure the Lambda function as the target for the EventBridge schedule
  1. AWS Instance Scheduler:
  • This solution automates start and stop actions based on predefined schedules
  • You can configure rules to apply to specific instances using tags
  • Set up a schedule to shut down your development instance at midnight

These methods help eliminate wasteful spending on idle resources during off-hours. For your development instance that doesn't need to run 24/7, implementing an automatic shutdown at midnight can significantly reduce your EC2 costs.
Sources
Stop and start EC2 instances automatically on a schedule using Quick Setup - AWS Systems Manager
Reduce IT costs by implementing automatic shutdown for Amazon EC2 instances | AWS Public Sector Blog
Community | EC2 cost optimization:15 ways to save on Amazon EC2
AWS Managed Services Resource Scheduler - AMS Advanced User Guide

con risposta un anno fa

AWS
TECNICO DI SUPPORTO

verificato un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.