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

small command to shortcut changing an instance type #276

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mostfunkyduck
Copy link

No description provided.

@mostfunkyduck
Copy link
Author

@mbailey any chance this can make it in?

@mbailey
Copy link
Contributor

mbailey commented Apr 20, 2020 via email

@mostfunkyduck
Copy link
Author

Possibly. What’s the behaviour if you run the command against a running instance?

it will error out. the instance MUST be in the stopped state for this to work. i COULD make it turn the instance off for you, but i personally prefer to chain together instance-stop, this, and instance-start

Do you need to restart the instance separately before it takes effect?

yes

For consistency with most other commands: - it would want instance-type to be the first arg and one or many instance ids as remaining arguments. - using skim-stdin would allow piping in instance-ids. Most of the instance commands have examples of this. There’s a video on the doc site on how it works. - confirm msg (see instance-terminate) is probably in order given change may be harmful and can act on multiple instances that may be provided via a pipeline (and thus not shown otherwise)

i can implement this next time i have a spare moment. if we're talking about automating multiple instances with a confirmation message, perhaps i will also make this do the stop/start

@mbailey
Copy link
Contributor

mbailey commented Apr 21, 2020 via email

@mostfunkyduck
Copy link
Author

We are a cloudformation shop transitioning rapidly to terraform. My need for this on top of an infra as code solution is because we need to do a controlled stop/start in order to do things like managing load balancers and gracefully draining connections. Infra as code doesn't easily support that, and cloudformation doesn't even let you import existing state back in to the template after a manual modification, which is a big reason we're switching to tf.

@mbailey
Copy link
Contributor

mbailey commented Apr 22, 2020 via email

@mostfunkyduck
Copy link
Author

Connection draining takes some time to do gracefully, but unless I missed something, I don't believe cloudformation will wait for it before doing its restart.

There's a couple of ways terraform makes handling out of band changes easier. First, whereas cloudformation only really supports correcting drift by updating the live resources to match the configuration, terraform lets you update your configuration to match what's live, so if there's drift you can correct it in your repository and be done.

Second, terraform supports an "import" function, which lets you specify that a given live resource maps to a given object in your configuration. So, for example, if you stood up a bunch of EC2 nodes manually and wanted to manage them in terraform, it's a matter of defining the resource in your terraform configuration, importing the resource into terraform, then tweaking your configuration to make sure that it reflects what's live so you don't accidentally change anything. https://www.terraform.io/docs/import/usage.html explains it pretty well

If you'd like to geek out about TF, feel free to email me. I just put a public-friendly email address on my profile. I'm sure there's also a chat service out there we could sync up on.

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