Reputation: 32
I want to create copy of my instance programmatically using javascript, and I also want to mount my S3 bucket to the newly created instance.
Is there a way to do "Launch more like this" using javascript.
Things I tried:
But it is not copying the contents of Original Instance into the newly created Instance. And also it is not mounting the S3 bucket.
Upvotes: 0
Views: 108
Reputation: 2943
Launch More Like This is an AWS Console UI functionality that copies over all settings of the current instance like AMI, Storage, Security Groups, AZs, Subnets etc, but still gives you an opportunity to make modifications before launching. This can be easily reproduced by coping over the the output of DescribeInstances API
and applying them to the RunInstances API.
It does not copy over the contents/data of the existing machine. If you need to copy over the contents, create an AMI of the existing instance and then launch the new EC2 instance using the new AMI.
To attach an S3 Bucket as a volume to your EC2 instance, you can use S3FS/Fuse You may want to install this as part of your AMI, so you don't need to install it each time you launch your instance. You can run the mount scripts as part of the init scripts, where you can specify or configure the S3 bucket to be mounted.
Hope this helps.
Upvotes: 1