0

I've just created a new Launch Configuration to use with an Auto Scaling group. When a new EC2 instance is launched, I would like the script to be executed.

In details:

  • I have a script deploy.sh that updates my application code using git...
  • When a new instance is launched by Auto Scaling, it should execute the script that I've provided via User Data in the Launch Configuration (attached on autoscaling group).

My user data is:

#!/bin/bash
/home/ec2-user/deploy.sh

This doesn't work.

1

2 Answers 2

6

Can you check the permission of your deploy script?

You can login to the instance and check the logs of User Data execution. Logs are at /var/log/cloud-init-output.log

Sign up to request clarification or add additional context in comments.

Comments

0

I've checked cloud-init-output.log and seems everything is okay.
I've done another test now and the new instance has the right code.
Probably there was a syntax error in launch configuration user data.

So, the right user data is

#!/bin/bash
/home/ec2-user/deploy.sh

Now I should add yum update before my custom script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.