shaibaz Badai
shaibaz Badai

Reputation: 32

How to do "Launch more like this" ec2-instances using javascript

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:

  1. Created an AMI
  2. Using that I created an instance.

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

Answers (1)

Yeshodhan Kulkarni
Yeshodhan Kulkarni

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

Related Questions