Start & Stop of EC2 instance using tags in Lambda function

0

Is there is any way to start & stop an EC2 instance using the tags in lambda function. Currently i am using a lambda function to start & stop an EC2 instance by the instance id. if the instance got replaced, the lambda function is not working. So inorder to fix this issue, i am curious on setting up a lambda function to start & stop the instance by using the Tags instead of instance id.

asked 2 years ago1767 views
2 Answers
2
Accepted Answer

Not directly with the API. You will need to update your Lambda function to DescribeInstances and filter on the tag key/value combination you desire and pass the returned instance ID to the relevant StartInstances/StopInstances method.

AWS
answered 2 years ago
1

if you want to make it easier for yourself, look at this:

https://aws.amazon.com/solutions/implementations/instance-scheduler/?nc1=h_ls

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions