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.

demandé il y a 2 ans1735 vues
2 réponses
2
Réponse acceptée

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
répondu il y a 2 ans
1

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

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

répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions