Lunch EC2 Instance in response to a URL

0

Hi, how do I Lunch an EC2 Instance in response to a URL (https://example.com) ? I have a lead time of 10-15 mins on lunching an EC2 instance, deploying the application and redirect the user to specific service. While the instance launch is in progress, a message should be displayed. I was looking at implementing that via AWS Lambda to start the instance, AWS SSM (Systems Manager) to automate the deployment via ssm_document = 'AWS-RunShellScript'. However, not sure about how the timeout will work OR is there any similar workaround. Any pointers will be highly appreciated. Thanks!

질문됨 4달 전130회 조회
1개 답변
1
수락된 답변

Hello.

I think it is possible to start EC2 when a URL is accessed by using API Gateway and Lambda.
I think the code provided in the blog below will be helpful for starting EC2.
https://repost.aws/knowledge-center/start-stop-lambda-eventbridge

It is possible to automate the execution of ssm_document by creating an EventBridge and Lambda that react to EC2 launch events.
I think the settings in the following document will be helpful for EC2 startup detection.
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-log-ec2-instance-state.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instance-state-changes.html

Finally, I think it is possible to switch by creating a Lambda that rewrites the A record of "https://example.com" to the EC2 IP after ssm_document execution is complete.

profile picture
전문가
답변함 4달 전
profile picture
전문가
검토됨 2달 전
profile pictureAWS
전문가
검토됨 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠