Start-stop EC2 instance using email

0

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?

Thank you.

gefragt vor 2 Jahren750 Aufrufe
3 Antworten
1

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).

profile pictureAWS
EXPERTE
beantwortet vor 2 Jahren
  • 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.

0

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.

beantwortet vor 2 Jahren
0

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.

profile picture
kyager
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen