filmov
tv
Use Python and Terraform to Manage EC2 Instances
Показать описание
👋 Hey everyone! Welcome back to my channel.
🎥 This demo shows you how to schedule times to start and stop your EC2 instances.
📊 The tools we use for this infrastructure include:
↳ EventBridge Rules
↳ Lambda
↳ SNS
↳ IAM
↳ Terraform
↳ Python
↳ EC2
Prerequisites:
↳ Terraform is installed on your local Machine.
↳ An Account with AWS.
↳ AWS CLI is installed on your local Machine.
Steps:
1. Clone this Repo to your local machine:
↳ cd aws-ec2-stop_start-terraform
2. Define the input variables:
3. Initialize, Plan, and Apply the Terraform Configurations.
↳ terraform init
↳ terraform plan
↳ terraform apply
4. Clean up
↳ terraform destroy
Troubleshooting:
↳ EventBridge Rules
↳ Verify that the EventBridge rules are correctly created in the AWS Management Console
↳ EventBridge
↳ Rules.
↳Also, ensure that the cron expressions are correct.
↳ Lambda Permissions:
↳ Ensure the Lambda permissions allow invocation by the EventBridge rules.
↳ The aws_lambda_permission resources should handle this.
↳ Lambda Execution
↳ Check the CloudWatch Logs for the Lambda functions to see if they are being invoked correctly and if there are any errors during execution.
↳ SNS Topic Subscription
↳ Ensure the email subscription to the SNS topic is confirmed.
↳ IAM Role Permissions: Ensure the IAM role attached to the Lambda functions has the correct permissions to start and stop instances and publish messages to SNS.
🎉 Congrats! You have successfully set up an infrastructure that will automatically start and stop your EC2 instances using Terraform.
💬 Leave any questions or comments below; I'll gladly help!
🎥 This demo shows you how to schedule times to start and stop your EC2 instances.
📊 The tools we use for this infrastructure include:
↳ EventBridge Rules
↳ Lambda
↳ SNS
↳ IAM
↳ Terraform
↳ Python
↳ EC2
Prerequisites:
↳ Terraform is installed on your local Machine.
↳ An Account with AWS.
↳ AWS CLI is installed on your local Machine.
Steps:
1. Clone this Repo to your local machine:
↳ cd aws-ec2-stop_start-terraform
2. Define the input variables:
3. Initialize, Plan, and Apply the Terraform Configurations.
↳ terraform init
↳ terraform plan
↳ terraform apply
4. Clean up
↳ terraform destroy
Troubleshooting:
↳ EventBridge Rules
↳ Verify that the EventBridge rules are correctly created in the AWS Management Console
↳ EventBridge
↳ Rules.
↳Also, ensure that the cron expressions are correct.
↳ Lambda Permissions:
↳ Ensure the Lambda permissions allow invocation by the EventBridge rules.
↳ The aws_lambda_permission resources should handle this.
↳ Lambda Execution
↳ Check the CloudWatch Logs for the Lambda functions to see if they are being invoked correctly and if there are any errors during execution.
↳ SNS Topic Subscription
↳ Ensure the email subscription to the SNS topic is confirmed.
↳ IAM Role Permissions: Ensure the IAM role attached to the Lambda functions has the correct permissions to start and stop instances and publish messages to SNS.
🎉 Congrats! You have successfully set up an infrastructure that will automatically start and stop your EC2 instances using Terraform.
💬 Leave any questions or comments below; I'll gladly help!
Комментарии