Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Adhoc#start_inactive_instance logic #36571

Merged
merged 1 commit into from
Sep 11, 2020
Merged

Simplify Adhoc#start_inactive_instance logic #36571

merged 1 commit into from
Sep 11, 2020

Conversation

wjordan
Copy link
Contributor

@wjordan wjordan commented Sep 2, 2020

When starting a stopped EC2 instance its public IP address changes, because IPv4 addresses are not retained for inactive network interfaces. In order for an adhoc instance (which does not use a CDN or load-balancer) to continue serving public traffic, its DNS entries need to be updated to point to the new IP addresses when the instance is started again.

Previously, the adhoc:start_inactive_instance rake task would call #start on the EC2 instance, then manually update the DNS entries linked from the CloudFormation stack via change_resource_record_sets. This had an issue where it would prevent the DNS records from deleting when the stack is deleted, because the AWS::Route53::RecordSetGroup CloudFormation resources would become out of sync with the actual entries. The issue prevents adhoc stacks from being deleted and re-created due to the left-over DNS entry.

This PR fixes the issue and simplifies the start_inactive_instance implementation by modifying the UserData property of the daemon instance and updating the stack. This triggers a reboot of the EC2 instance (causing it to start), and also triggers the RecordSetGroup resources to be updated to the instance's new values.

@wjordan wjordan requested a review from sureshc September 2, 2020 18:05
@wjordan wjordan merged commit 0893fd0 into staging Sep 11, 2020
@wjordan wjordan deleted the start-adhoc branch September 11, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants