1

I am looking for a solution to make a POST Request to an External API when the state of an EC2 Instance changes. I want to use Cloudwatch so that I can pass the InstanceId to the API with the Input Transformer option.

Is there a way to do this without involving Lambda? (upstream requirement) Perhaps with an SSM Automation?

DTD
  • 51
  • 8
  • Have a look [here](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) at lifecycle scripts. Lambda is likely the easiest way, but using scripts on the instance might work if the instance is up / available. – Tim Jan 29 '19 at 18:14

1 Answers1

0

You can send the CloudWatch events to SNS Topic or SQS Queue and have a subscriber somewhere that will do the API call when the event happens. However you still need to host the subscriber somewhere, give it the permissions to subscribe to the topic / queue, etc.

It would be much easier to use Lambda with a simple IAM Role. Can you elaborate why it isn't an option? Why would you not use the best suited tool for the job at hand?

MLu
  • 23,798
  • 5
  • 54
  • 81