Use Python and Terraform to Manage EC2 Instances

preview_player
Показать описание
👋 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!
Рекомендации по теме
Комментарии
Автор

Thank you it was quick and simple. understood all of it and gonna rewatch it again and try to perform it myself. i'll have to install terraform + aws cli though. just wanted to ask do you have any resource for the installation of these two else will search around on the internet. again great video thanks !!

ahmadmudassir
Автор

You should try to zoom in on your screen, I couldn't see much.. great video ....

pojuagbomeji