AWS Classroomnotes 04/Mar/2022

Creating the Start Stop ec2 instances as lambda function

  • Lets Create an IAM role for lambda to start or stop ec2 instances
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
    Preview
  • Lambda function to start ec2 by tag
    Preview
    Preview
  • Lambda function to stop ec2 by tag
    Preview
  • Now lets call these functions based on schedule
    • Every weekday on 10 AM we start the ec2 instances
    • Every weekday on 7 PM we stop the ec2 instances
  • For this we need to create an Event Bridge to create rule for ec2_start and ec2_stop
    Preview
    Preview
    Preview
    Preview
    Preview
  • Exercise:
    • Create a role for aws lambda to have ec2 full access and cloudwatch full access.
    • Create an ec2 instance and add a tag env & value qa
    • NOw create a lambda function with code Refer Here
    • Try to use Test Event to start or stop ec2 instance which you created.
    • Optional: try to create a lambda function which stops the rds instances by their tag Refer Here

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube