-
Notifications
You must be signed in to change notification settings - Fork 341
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
ec2_instance - Upgrade / downgrade ec2 type on the fly #469
Comments
I think all described possibilities will break backwards compatility. In case the In case the AZ is running out of capacity of the new instance type, you got an error/problem. |
There is a none-active PR left in community.aws that is targeting in this direction: |
Hi @gregharvey, Thank you for taking the time to reopen this. It's indeed an interesting feature idea. |
Thanks for taking the time to open this issue. The ec2 module was based upon the original boto SDK and was dropped in release 4.0.0 please use the ec2_instance module instead which I believe has this functionality. |
@tremble Is it possible to reopen this issue? Module I'm currently trying to write a playbook to change the instance type, and I'm unable to do it, even with the instance being shutdown. I know OP mentioned the module It would probably be better to rename this issue to something like Let me know if I can be of any help! |
@pgrenaud sure. For some reason I thought ec2_instance could modify the instance type, looking deeper at the code, it just doesn't throw errors. If you're interested in trying to add support for this feature, then it may just be a case of updating diff_instance_and_params() However, I'm not a big fan of trying to add the "force" parameter. The logic behind this has the potential to get very messy. |
…n the fly (#2298) SUMMARY Closes #469 Add the possibiliy to upgrade/downgrade instance type on existing ec2 instances. The module will stop the instance, modify the instance and then ensure the instance is in the expected state set in state argument. ISSUE TYPE Feature Pull Request COMPONENT NAME ec2_instance Reviewed-by: Alina Buzachis Reviewed-by: GomathiselviS
…n the fly (ansible-collections#2298) SUMMARY Closes ansible-collections#469 Add the possibiliy to upgrade/downgrade instance type on existing ec2 instances. The module will stop the instance, modify the instance and then ensure the instance is in the expected state set in state argument. ISSUE TYPE Feature Pull Request COMPONENT NAME ec2_instance Reviewed-by: Alina Buzachis Reviewed-by: GomathiselviS
OP is @pkaramol - see ansible/ansible#33373 (closed by bot)
SUMMARY
Enable on-the-fly instance type change (upgrade / downgrade).
Currently when running a script that creates ec2 instance(s), there is no way to perform a type change (e.g. from
t2.micro
tot2.small
).ISSUE TYPE
COMPONENT NAME
ec2_instance (as proposed in original ticket - see ansible/ansible#33373 (comment))
or potentially a new module (as suggested here - ansible/ansible#33373 (comment))
ADDITIONAL INFORMATION
If you want to use Ansible to manage infrastructure then you need to be able to up and down grade EC2 instance type as part of that. Currently we need to use the CLI, which is simple enough, but it would be more elegant of Ansible just handled this.
Here's the OP again:
Using vars from below
and running the following task based on those vars:
if those instances are there and running and one wants to re-run the script, having one of the instance types changed (from
t2.micro
-->t2.small
), e.g. as follows:the script runs idempotently again, although the output yields:
(output trimmed).
OP's point being he expected the instance size to change. There's some follow-up discussion between @ryansb and @bobobox about how this might be implemented, and a plan seems to be formed, specifically:
force:
flag is set totrue
, then ec2_instance stops the instance, changes the type, and starts it back up.And some specific concerns, which caused the suggestion the default behaviour ought not to be just blindly change instance type:
It's this complexity which makes the original participants consider that maybe this is a separate module entirely, as
instance_type
is already optional forec2_instance
.Anyway, putting this back in as it feels valid and it seems to have been dropped.
The text was updated successfully, but these errors were encountered: