Start-stop EC2 instance using email
Hello, I would like to build a solution where I can start an EC2 instance by sending an email with a specific keyword (i.e "start)". Once the EC2 instance is started, it should reply to me via email with public IP. When I want to stop the instance, I should be able to send an email with a keyword. And then it should reply back to me saying that the instance has been shutdown.
What AWS services I can use to achieve this?
I think that SES is a possibility here given that it can do both outbound and inbound email handling.
However: I don't think that this is a good idea. It's not secure. Anyone could email instructions on your behalf. And (generally) email is sent around in clear-text so interception is always a possibility.
If it were just outbound notifications then SNS is a good fit; it can also use email but also SMS (among other delivery methods).
Thanks for the answer. I just realized that it's a risk. What do you think the alternative is? I just need to start and stop instances from anywhere without logging in to the console. And I need to know their public IP addresses when they are started.
This is going to be a Dev server. So we can ignore the risk of someone intercepting emails. Could anyone point me to some guides where I can set this up? I am not familiar about AWS services other than EC2. I'm hoping I can set up incoming email processing through SES and trigger a Lambda function to read the email content, check the instance status and turn it on or off. Any help would be greatly appreciated.
I think a nicer solution would be to setup the AWS CLI, from there you can easily start and stop your instances, or even execute a lambda function that handles instance state. It would actually be secure, and more robust.
There would be very little overhead once the CLI is setup, you could then even create a script that calls the CLI commands so you don't have to constantly type them out.
You can read more about the AWS CLI here: https://aws.amazon.com/cli/
I would strongly recommend against allowing this to happen via email, emails can easily be spoofed, and even if the data is not sensitive, somebody could just spam you with a bunch of start emails and then you're stuck with a bill for 100 instances you didn't want.
EC2 instance failure, wont startAccepted AnswerAWS-User-1296388asked 4 months ago
Mac EC2 instance stuck in "shutting-down" statedyakhnovasked 4 months ago
Resize EC2 Spot InstancesAWS-User-7755424asked 3 months ago
Stopping and Starting EC2 instance wipes databwassieasked 3 years ago
Instance stuck on "stopping" statusTXwebmasterasked a year ago
Failed to force stop instancestijncontinuitasked a year ago
Start-stop EC2 instance using emailph4n7om2000asked 11 days ago
Switch an EC2 instance from on-demand to spot pricingAWS-User-7687569asked 3 months ago
Start & Stop of EC2 instance using tags in Lambda functionAccepted AnswerAWS-User-2038220asked 2 months ago
EC2 Instance Stuck in "stopping" statevipersephasked 3 years ago