0

A friend accidentally configured an EC2 instance to use "dedicated" tenancy, not realizing that it didn't actually provide a dedicated server and was surprised it cost an additional $2/hour, so we're trying to untangle this now. We want to just change it over to use the default "shared" tenancy and not spend $1400/month for no reason.

The problem is that this is apparently a one-way operation. According to the AWS EC2 user guide, You can shut down an instance change its "shared" tenancy to "dedicated", but you can't undo it once it's launched:

After you launch an instance, there are some limitations to changing its tenancy.

  • You cannot change the tenancy of an instance from default to dedicated or host after you've launched it.
  • You cannot change the tenancy of an instance from dedicated or host to default after you've launched it.

It's true, the console doesn't give you the option to change tenancy back to "default". If you shut down the instance and use ec2 modify-instance-placement from the CLI like this:

aws ec2 modify-instance-placement \
    --instance-id i-0e6ddf6187EXAMPLE \
    --tenancy default

It causes the error: "An error occurred (InvalidTenancy) when calling the ModifyInstancePlacement operation: Invalid value 'default' for Tenancy."

Another approach is to launch a new instance with the correct tenancy, but using some kind of a snapshot of the current one and re-using the old one's EBS volumes. I could not for the life of me figure out how to do this in the AWS console, and I'm not sure the script I've cobbled together does the job.

In any case, we want to undo this mistaken configuration and end up with a running instance that is exactly the same as the current one, except with shared (default) tenancy. The instance is backed up, it is running Windows Server 2012 and SQL Server, has one public elastic IP, two EBS volumes and short downtime is allowable. What's the best way to get it done quickly and safely? Thanks for your advice in advance.

2 Answers 2

3

Create a snapshot of the volume, create an AMI from that, and then launch a new instance. Documentation is here for Linux, here for Windows. I would copy out the steps but it's fairly pointless duplication, given AWS documentation is well maintained and regularly updated.

2
  • Thanks, reading now. Not sure if it matters this is Windows Server 2012, I noticed your link went to the Linux guide and there didn't seem to be a corresponding page in the Windows side: docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/AMIs.html I've edited my question with this clarification. Oct 19, 2020 at 19:22
  • The concept is the same - create AMI, create new server. I've added a link.
    – Tim
    Oct 19, 2020 at 19:28
0

2022 Update:

When the instance is in stopped state. Tenancy change via CLI using the following command works.

    aws ec2 modify-instance-placement \
    --instance-id i-0e6ddf6187EXAMPLE \
    --tenancy default

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .