March 2, 2019

Serverless Series - Serverless WebApp - Use Case 2

 Serverless Series HomeThis blog post will be taking you through the details to build Serverless WebApp - Use Case which will get the running EC2 instances with tag AutoOff=yes through lambda function and stop those instances, display the details in webpage and add to cloudwatch logs.

Network Diagram

Output  Webpage


Steps to AutoOff EC2

  • Copy StopRunningInstances.py code to replace existing Lambda Function 
  • Add `AmazonEC2FullAccess` LambdaExecutionRole created earlier
  • Create one or more EC2 instances with tag name `AutoOff` with the value `yes` (case sensitive)
  • Launch the S3 Static Website URL to test the running EC2 instances with the tag AutoOff=yes are shutdown.

Cleanup
  • CloudWatch console Delete the log group /aws/lambda/ServerlessWebAppDemo under CloudWatch Logs
  • S3 console -> Delete S3 Bucket serverlesswebappdemo
  • Lambda consolue -> Delete Lambda Function - ServerlessWebAppDemo
  • API Gateway console -> LambdaMicroservice -> Resources -> ServerlessWebAppDemo
  • IAM console -> Roles -> Delete Role - LambdaExecutionRole


No comments:

Post a Comment