I would like to run an Amazon EC2 spot instance as CI server.
In order to keep the historical information I would like to keep all the data on separate EBS volume due to the fact the EBS volume of the spot instance will be deleted each time it will be terminated.
How can I mount the EBS volume during startup?
Thank you,
Ido.
you can have a
initscript that attaches the already available volume, using this command:for this to work, you need
EC2-API installed on the machine
you need to have
EC2_PRIVATE_KEYandEC2_CERTas environment variable or will have to pass explicitly.The volume you’re trying to attach should be available. Or, optionally, you can first force detach the volume.
you may use
curl http://169.254.169.254/latest/meta-data/instance-idto get hold of current instance’s instance_id.Refer:
Hope this helps.