-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Re-attaching EBS volumes to new EC2 instances... #2740
Comments
Same issue here. I also tried to create an aws_ebs_volume and attach it with aws_volume_attachment. But here I don't see how we can bootstrap (mkfs + mount) the disk with cloudinit or a provisioning script. |
I've managed to reattach a volume (including mounting) using the
If one wants to use an EBS volume attached to a docker container, like in the example above. Make sure |
No update on this ? Should we use aws_ebs_volume instead ? |
Regarding your question
I'm pretty sure you could bootstrap it via the #!/bin/bash
mkfs -t ext4 /dev/xvdh #boostrapping
mkdir /data #create mount point
mount /dev/xvdh /data #mount it
#service docker restart (if you want to use it as a docker volume)
Well, I guess for the creation it would be correct Does this helps you? |
Well, you can do that if you are using an "aws_ebs_volume" resource. But not an "ebs_block_device" insinde an "aws_instance" resource. I was hoping doing the bootstrap of the ebs volume outside of CloudInit since I have a lot of difference instances and most of the time the only differences are about EBS. |
O.k., now I see your point. It's an interesting question. |
Hey all – I believe this issue has been resolved with |
I have an existing volume that I want to attach to an Amazon Linux instance and ensure that upon reboot it will be reattached.
The process runs as follows, eventually timing out because the
It seems that the
Of course, the volume is attached but not mounted. My questions is, how can any cloud-init I would appreciate knowing if I am thinking of this all wrong. Thanks! |
After much testing, the most reliable solution has turned out to be using a provisioner on the
|
Is @aiwilliams approach still considered the best way to do this? Notably, this doesn't work well (at all?) if your |
@mwakerman i suppose you can set a bastion_host in your provisioner
i have the same issue and just discovered that provisionners can be attached to any resource, not just the instance, and that's going to fix a big issue for me. |
So it looks like terraform doesn't allow you to use a passphrase encrypted Ended up doing it all in user-data by giving the instance an IAM role that included an
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Hey guys,
I have a scenario where if I decide to bring down an EC2 instance in order to update my Elasticsearch version to a new version (this setup is for my Elasticsearch cluster on AWS), I would like to detach my EBS volume and re-attach it to the new EC2 instance with the updated Elasticsearch AMI.
I believe I can already detach an EBS volume on EC2 destruction this way:
However, I'm still trying to find out how to re-attach this existing EBS volume to a new EC2 instance in Terraform prior to bringing that EC2 instance/node back into my cluster.
Can you guys please help me with this?
Thanks,
Ben.
The text was updated successfully, but these errors were encountered: