Schedule requests to IIS using AWS - amazon-web-services

I have been struggling around this for some time now, I have seen there are many options to make schedules request to APIS through AWS but I could not make it work.
My case is to make a external schedule request do an API that is inside IIS on an EC2 instance.
Could someone please tell me what is the best approach to make it work? Do I need an AWS VPC or CloudWatch? There is no way of doing it directly?
Thank you.

Create a Lambda with a cron trigger with the schedule you want to create.
Lambda can make a call to IIS at the scheduled time.
https://docs.aws.amazon.com/lambda/latest/dg/with-scheduled-events.html
Hope it helps.

Related

Send AWS EC2 metrics to AWS Elasticsearch Service Domain for monitoring in Kibana

I am stuck on one point I have created one EC2 Linux based instance in Aws.
Now I want to send the EC2 metrics data to the managed Elasticsearch domain for monitoring purposes in Kiban, I go through the cloud watch console and check the metric is present of instance but didn't get how to connect with the Elasticsearch domain that I have created.
Can anyone please help me with this situation?
There is no build in mechanism for extraction/streaming of metrics data points in real time. You have to develop a custom solution for that. For example, by having a lambda function which is invoked every minute and which reads data points using get_metric_data. The the lambda would inject the points into your ES.
To invoke a lambda function periodically, e.g. every 1 minute you would have to setup CloudWatch Event rule with schedule Expressions. Lambda function would also need to have permissions granted to interact with CloudWatch metrics.
Welcome to SO :)
An alternative to the solution suggested by Marcin is to install metricbeat on the EC2 Instance and configure the metricbeat config file to send metrics to your Managed AWS ES Domain.
This is pretty simple and you should be able to do this fairly quickly.

Scheduling to start and stop Ec2 instance in aws compaired to azure?

I am trying to start and stop my EC2 instances at a specific time of the day.
There is a scheduled start and stop VMS options available in Azure.
I am wondering if something similar to that is present in AWS.
if not what is the best way to achieve it?
assuming 7am I start my EC2 and stop it by 9pm IST. I am also aware of the cloud watch event integrated with lamnda option
Based on the comments.
The lambda function would be only required to start your instance, if you want to trigger it using CloudWatch (CW) Event rule. The reason is, that you can stop the instance directly, using CW built-in targets:
Built-in targets: EC2 CreateSnapshot API call, EC2 RebootInstances API call, EC2 StopInstances API call, and EC2 TerminateInstances API call.
Sadly, there is no build-in target for starting the instance, thus lambda function is needed for that.
Create two different Lambda function to launch and terminate an EC2 instance and schedule them via CloudWatch. For the Lambda you can use any language from the AWS SDK. To select a particular instance to terminate, the EC2 instance can be tagged to segregate it. Here is the solution for the same.
Here is the complete guide https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-cloudwatch/. Let me know if that helps.
As suggested by Praveen Sripati https://aws.amazon.com/solutions/implementations/instance-scheduler/ works pretty well.

Schedule Auto Shutdown of resources in AWS

I am trying to schedule auto start or stop resources(EC2 Instances) for specific timings on AWS.
Is there an API to do the same ?
You can do this with the help of Lambda and CloudWatch.
Please refer: https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-cloudwatch/
Hi If you want to put automation for start and stop a particular set of or a particular ec2 instance now this is possible using AWS System Manager you can do a lot more. I would strongly recommend to check out the official documentation it helped me sure it will help you as well AWS System Manager
You can also set up a Lambda function to start and stop EC2 AWS Setup a Lambda to Start and Stop EC2 Instance
Please let me know if you need some help.
We are using the instance scheduler stack. You can easily create a cloudformation stack then use tags to define which and when the instances need to stop and started.
Reference:
https://docs.aws.amazon.com/solutions/latest/instance-scheduler/architecture.html

On AWS, run an AWS CLI command daily

I have an AWS CLI invocation (in this case, to launch a configured EMR cluster to do some steps and then shut down) but I'm not sure how to go about running it daily.
I guess one way to do it is an EC2 micro instance running a cron job, or an ECS task in a micro that launches the command, but that all seems like it might be overkill. It looks like there's also a way to do it in Lambda, but rom what I can tell it'd be kludgy.
This doesn't have to be a good long-term solution, something that's suitable until I can do it right (Data Pipelines) would work just fine.
Suggestions?
If it is not a strict requirement to use the AWS CLI, you can use one of the AWS SDK instead to programmatically invoke Lambda.
Schedule a CloudWatch Rules using cron
When configured, the CloudWatch Rules will trigger a Lambda function
Implement a Lambda function that calls EMR using one of the supported SDKs (e.g. the EMR class in the AWS JavaScript SDK)
Make sure that you have the IAM configuration in place
Full example is available in the Schedule AWS Lambda Functions Using CloudWatch Events
Kludgy? Yes, configuration is needed, however if you take into account the amount of work required to launch EC2 / ECS (and make sure that it re-launches in the event of failure), I'd say it evens out.
Not sure about the whole task that you are doing, but to avoid doing it:
Manually
Avoid another set up for resources in AWS (as you mentioned)
I would create a simple job in a Continuous Integration (CI) server like jenkins,bamboo,circleci ..... (list can go on). I would assume that you might already have a CI server running, why not use it?

Alternative to scheduled tasks

I'm moving stuff from Azure to AWS, and the only thing I'm really gonna miss is the webjobs, where I can schedule command line jobs.
I know I can achieve somewhat the same with task scheduler or windows services, but I do also like the way webjobs shows logs and that stuff...
Do anybody know a tool like that, that can run windows command line apps on AWS?
Checkout AWS Lambda. It is a new service from AWS.
AWS Lambda, compute service that runs your code in response to events and automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information.
Lambda vs WebJobs