Support Documents

Lambda Function to Shut Down and Terminate an EC2 Instance

Lab Details

  1. This lab walks you through shutting down and terminating EC2 instances using AWS Lambda. In this lab, we will create a sample lambda function. This lambda function when triggered will shut down and terminate an EC2 Instance.

  2. Duration: 30 minutes

  3. AWS Region: US East (N. Virginia) us-east-1

Architecture Diagram

Task Details

  1. Log into the AWS Management Console.

  2. Create two EC2 instances.

  3. Create an IAM Role.

  4. Create a lambda function.

  5. Configure a test event.

  6. Performing stop and terminate actions on EC2 Instances

  7. Check the EC2 instance’s status

  8. Performing stop and terminate action again

  9. Check the EC2 instance’s status again

  10. Validation of the lab