Eventbridge Scheduler - Automatically shutdown EC2 machines on weekend

  Рет қаралды 469

AWS Training by Gaurav Agrawal

AWS Training by Gaurav Agrawal

Күн бұрын

Пікірлер: 19
@that_epics
@that_epics 9 ай бұрын
I need your one more help can you please help me out: Q. How can I getcustomised email notifications when someone creates an EC2 instance that’s not nano, micro, small or medium? can you please help me out...
@AWSTrainingByGauravAgrawal
@AWSTrainingByGauravAgrawal 9 ай бұрын
Please refer to this video - kzbin.info/www/bejne/jnjOnmV4rLOjr6s For your requireement, the flow will be - EC2 Service -> listen to EC2 create instance events in Eventbridge --> Trigger lambda --> Send email to an group or whoever you want.
@shrig018
@shrig018 10 ай бұрын
great video! helped me out a lot. was using event scheduler as a starting point and the process just seemed so confusing! many thanks
@AWSTrainingByGauravAgrawal
@AWSTrainingByGauravAgrawal 10 ай бұрын
Glad it helped!
@shrig018
@shrig018 10 ай бұрын
Any idea how I can see the logs? When I go to cloudwatch logs I get error saying the log group does not exist
@01_Keren
@01_Keren 9 ай бұрын
Is it possible to do that directly without using a lambda for shutting down ec2?
@15724388200
@15724388200 9 ай бұрын
No you cannot do it without a compute instance. you need a way to run some code which will trigger the shutdown command to the correct set of instances and thats where lambda's come in. They are on demand and you only pay for the time it is running, so it actually very cost effective.
@that_epics
@that_epics 9 ай бұрын
we can do it with Azure DevOps pipeline completely free
@tapiaomars
@tapiaomars 3 ай бұрын
yeah, you can do it without using a lambda... no compute, just use event bridge for EC2 stop (not lambda), obviously you need IAM Role for your Scheduler (trusted policy for scheduler and IAM policy for actions on ec2) .... and you have a EC2 scheduler without lambda now guy :)
@kapilghule751
@kapilghule751 10 ай бұрын
please give me a script for how to start multiple EC2 instances?
@AWSTrainingByGauravAgrawal
@AWSTrainingByGauravAgrawal 10 ай бұрын
If you know the list of ec2 instance id's then you can run the following aws command - aws ec2 start-instances --instance-ids i-INSTANCE_ID1 i-INSTANCE_ID2 i-INSTANCE_ID3
@that_epics
@that_epics 10 ай бұрын
@@AWSTrainingByGauravAgrawal ​Sure I can use that, however, I would like a script like you mentioned Python script, for example, to shut down the instance and I would use multiple instance IDs to auto-start the instance. Is it possible to get a complete Python script to auto-start the instance? it will be very helpful for me
@AWSTrainingByGauravAgrawal
@AWSTrainingByGauravAgrawal 10 ай бұрын
@@that_epics use the below python lambda code import boto3 def lambda_handler(event, context): # Create a Boto3 EC2 client ec2 = boto3.client('ec2') # Describe all instances in your account instances = ec2.describe_instances() # Extract instance IDs from the response instance_ids = [] for reservation in instances['Reservations']: for instance in reservation['Instances']: instance_ids.append(instance['InstanceId']) # Start all instances if instance_ids: ec2.start_instances(InstanceIds=instance_ids) return f'Starting instances: {instance_ids}' else: return 'No instances to start' # Note: Make sure that your Lambda function has the appropriate IAM permissions to describe and start EC2 instances.
@that_epics
@that_epics 10 ай бұрын
​@@AWSTrainingByGauravAgrawalSorry I am bothering you but where is the name of the tag like start=true and where I can mention only two or three examples of the ID is only.
@that_epics
@that_epics 10 ай бұрын
Earlier script you mentioned tags to stop each instance
Docker On EC2
18:55
AWS Training by Gaurav Agrawal
Рет қаралды 357
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 105 МЛН
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 21 МЛН
Automate AWS EC2 with Python | DevOps Coding Challenge
16:25
Travis Media
Рет қаралды 17 М.
Kubernetes on Spot Instances for a Cost-Effective and Reliable Cloud Setup
38:53
Amazon EventBridge Pipes - A Crash Course
28:44
Enlear Academy
Рет қаралды 3,9 М.
CloudWatch   Centralized Logging and Monitoring
14:03
AWS Training by Gaurav Agrawal
Рет қаралды 1,9 М.
Automatically Start and Stop EC2 Instances with AWS Instance Scheduler
12:41
Tiny Technical Tutorials
Рет қаралды 20 М.
GIANT Gummy Worm Pt.6 #shorts
00:46
Mr DegrEE
Рет қаралды 105 МЛН