I'm trying to create an EC2 instance that has an e...
# aws
b
I'm trying to create an EC2 instance that has an extra data volume attached. I have used
Instance
,
Volume
and
VolumeAttachment
to do this. I'm now trying to figure out how to init the volume and mount it within the instance. I'm doing this via instance user data. However, when I make changes to
userData
and re-run
pulumi up
I get this error
Copy code
* Error attaching volume (vol-0170f920a526fb90d) to instance (i-003ab040459a35189), message: "vol-0170f920a526fb90d is already attached to an instance", code: "VolumeInUse"
I think this isn't working because the volume is still attached to the old instance. Can pulumi handle detaching the volume?
l
I think you want to change from plain userData to cloudinit or some other way to run code only on instance creation.
Pulumi cannot attach or detach volumes, it can only deploy the code that does that.