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...
@AWSTrainingByGauravAgrawal9 ай бұрын
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.
@shrig01810 ай бұрын
great video! helped me out a lot. was using event scheduler as a starting point and the process just seemed so confusing! many thanks
@AWSTrainingByGauravAgrawal10 ай бұрын
Glad it helped!
@shrig01810 ай бұрын
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_Keren9 ай бұрын
Is it possible to do that directly without using a lambda for shutting down ec2?
@157243882009 ай бұрын
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_epics9 ай бұрын
we can do it with Azure DevOps pipeline completely free
@tapiaomars3 ай бұрын
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 :)
@kapilghule75110 ай бұрын
please give me a script for how to start multiple EC2 instances?
@AWSTrainingByGauravAgrawal10 ай бұрын
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_epics10 ай бұрын
@@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
@AWSTrainingByGauravAgrawal10 ай бұрын
@@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_epics10 ай бұрын
@@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_epics10 ай бұрын
Earlier script you mentioned tags to stop each instance