What would be the easiest way to use AWS to fire code at a certain date and time? Is it possible to use AWS Lambda, or would I need to create a web service in EC2? I prefer to use Xcode for iOS and if necessary Java using Eclipse and the AWS Toolkit and Elastic Beanstalk. I am creating an iOS app that fires remote notifications to the user at specified dates and time?
2 Answers
AWS Cloudwatch has a service called event rules
, you can use it as cronjob (schedule jobs).
There is another service called Step Functions
, you can use to put these tasks together with some logic.
Take a reference with below url as start.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/Create-CloudWatch-Events-Rule.html
https://blog.shikisoft.com/3-ways-to-schedule-aws-lambda-and-step-functions-state-machines/

- 42,880
- 12
- 99
- 116
-
What is a cronjob? Is that specific to AWS, or a more general programming topic? – daniel Apr 24 '20 at 06:03
-
Ok. I got it. cron job is a Linux thing. – daniel Apr 24 '20 at 06:04
You can use AWS Lambda with a cloudwatch event schedule (either a rate like every 10 mins or a cron based schedule), it's all pretty easy to setup in the AWS console.
Lambda runtimes include: Node.js, Java, Python, and dotnet. The only thing you'd have to watch out for is your deployment package (code plus additional libraries) must be below 250Mb.
There are a few serverless frameworks (including one called Serverless) that can help setup and maintain projects, but for simple functions it's just as easy to write code directly in AWS console.

- 434
- 2
- 9
-
I'm actually creating an iOS app, so I would need to use code in my app to do some of the tasks, not just in AWS console. – daniel Apr 24 '20 at 06:06
-
1Use API Gateway to setup a REST API that you can call from your app; lambda can be triggered by an HTTP call from your app and return a response when it's done. You can use JSON or XML or other protocol to transfer data between app and lambda function. – quizzical_panini Apr 24 '20 at 06:39
-
I need lambda to work with AWS SNS to send a remote notification to my iOS app. – daniel Apr 24 '20 at 11:03
-
If I use REST API and HTTP, would I have to have my own server? I don't want to have to use my own server. – daniel Apr 24 '20 at 15:12
-
1Nope: it's all hosted by AWS. See API Gateway page [here](https://aws.amazon.com/api-gateway/). Your app hits the aws endpoint, that spins up the lambda instance, which runs your code, and returns whatever response you want, your app can then use that result. Your app just has to make a REST call and parse the response. – quizzical_panini Apr 24 '20 at 18:09