Passing a script while starting an instance in Amazon EC2

0 votes

Is it possible to pass a script while starting an instance? Well, I want the script to be executed once the instance is initialized.

Any idea? The script will be kind of beginner script which I need to execute as soon as the instance is ready. Thanks in advance.

Mar 25 in AWS by datageek
• 2,940 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Use the user data to pass a script to a new EC2 Instance. I am not sure if you can start a pre-existing instance and pass it data.

I have a pre-configured AMI that has a script saved on the root drive.  This script is used to configure the server and download the latest source.

So your request could look like the following:

var runInstance = new RunInstancesRequest();

            .WithSecurityGroup("{the security group}")
            .WithKeyName("{your key}")


The user data can contain either a reference to a script or the script itself.

answered Mar 25 by Archana
• 5,360 points

Related Questions In AWS

0 votes
1 answer

nstalling phpMyAdmin in Amazon EC2 instance

I needed to update the /etc/httpd/conf.d/phpMyAdmin.conf to allow remote ...READ MORE

answered Jul 13, 2018 in AWS by Cloud gunner
• 4,240 points
0 votes
1 answer
0 votes
1 answer

How to upload a lib for Tomcat in Amazon EC2?

You need to set the proper privileges ...READ MORE

answered Aug 20, 2018 in AWS by Archana
• 4,090 points
0 votes
1 answer

In Amazon Data Pipeline, how to make sure only once instance of a pipeline is running at any time?

On the CopyTablesActivity, you could set a lateAfterTimeout attribute ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 56,140 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.