Reputation: 2099
I have a general AWS question. I have started using AWS sdk, but looks like if I want to receive events asynchronously from AWS(ex: cloudwatch events), lambda functions is the only way. I want to write a simple application that registers a callback to AWS for events, but i couldn't find a way to do that till now, since i don't want to use lambda, i have been polling from my application. Please, let me know if polling is the only option or if there is a better way to resolve it without polling.
Upvotes: 1
Views: 360
Reputation: 864
Already above answers might also be helpful, but one of the possible options to address your problem could be one of this as well.
You can make use of AWS SNS service to subscribe for the events on AWS resources. And the SNS can publish the events to your application end point. Which is nothing but pub/sub model.
Refer this link http://docs.aws.amazon.com/sns/latest/api/API_Subscribe.html
The end-point could be your http or https based application.
Upvotes: 2
Reputation: 200617
From the documentation:
You can configure the following AWS services as targets for CloudWatch Events:
Amazon EC2 instances AWS Lambda functions Streams in Amazon Kinesis Streams Delivery streams in Amazon Kinesis Firehose Amazon ECS tasks SSM Run Command SSM Automation Step Functions state machines Pipelines in AWS CodePipeline Amazon Inspector assessment templates Amazon SNS topics Amazon SQS queues Built-in targets The default event bus of another AWS account
That's a lot more than just Lambda, so I'm not sure why you state in your question that Lambda is the only option. The options of Amazon EC2 instances
and Amazon SNS topics
both provide a method for Amazon to "push" the events to your services, instead of requiring your services to poll.
Upvotes: 3
Reputation: 6876
With cloudwatch events, you can set rules and trigger a number of different targets, including SQS queues which you can poll from your EC2 Instances.
Lambda is certainly a popular endpoint, but based on the docs, there are other targets you can send the events to
Upvotes: 3