Questions tagged [ec2-userdata]
42 questions
4
votes
1 answer
Install nvm / node on AMZ Linux 2 EC2 Instance with userData script
I'm trying to install nvm / node on an AMZ Linux 2 EC2 Instance using the following userData script:
#!/bin/bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
. ~/.nvm/nvm.sh
nvm install 16.17.0
nvm use…

RobertFrenette
- 629
- 3
- 8
- 29
3
votes
3 answers
AWS: Difference between User data and Metadata tags when creating EC2 instance
Amazon EC2 instances can be created with 'User Data' (a long string), or metadata tags (a number of key/value pairs).
What is the difference between these? Why do these two systems exist in parallel?
In particular, I wish to pass certain pieces of…

Jason Crease
- 1,896
- 17
- 17
2
votes
1 answer
Cisco CSR user-data bootstrap to allow multiline in banner
The user data format for the IOS appliance uses the following:
ios-config-0001="hostname test-csr-deployment-001"
ios-config-0002="banner exec |Hostname: test-csr-deployment-001\r\nRegion: eu-west-2|"
The commands are accepted, but the returned…

itChi
- 642
- 6
- 19
1
vote
1 answer
Powershell Jfrog RT Download leads to NativeCommandError
I am currently trying to create a Powershell script that includes the download of an artifact from jfrog.
When running the script, I keep getting
+ jf rt download --url $url --user $username --password $password $repo ...
+…

lars
- 307
- 1
- 3
- 10
1
vote
0 answers
cloud formation unable to receive SUCCESS signal from user-data shell script causing status "ROLLBACK_COMPLETE"
Below is a shell script which I am using as user-data.sh
The issue is cloud formation stack is not getting a "SUCCESS" signal and therefore it goes to ROLLBACK_COMPLETE status.
#!/bin/bash -x
exec > >(tee /var/log/user-data.log|logger -t user-data…

learner
- 2,480
- 10
- 50
- 94
1
vote
0 answers
Not able to run a user-script on some EC2 instances started from an AMI of ubuntu 20.04
I am launching multiple ( more than 100 EC2 instances ) from a previously set AMI. This AMI is made from an Ubuntu 20.04 AMI. Everything that is required for the work is already satisfied in AMI. Now I just want execute an user-script while…

Aryan Agarwal
- 69
- 5
1
vote
1 answer
How to pass user-name and password to Clone a private repo via aws user-data
I am trying to clone a repo using git on a ec2 server, my goal is to get a repo on it and for that I am planning on executing a shell script as user data. Please suggest me how do I authenticate to github on the fly
I tried installing git and then…

Jarvis
- 41
- 3
1
vote
1 answer
Running UserData with Powershell >= 7.0 on Windows Server 2022 on EC2
UserData by default will run with Powershell V5.1 on the Windows Server 2022 AMI on an AWS EC2 instance that spins up. However, I want to use some cmdlets that are only supported in Powershell version 7 and greater.
How am I best able to run a…

Michael
- 31
- 4
1
vote
1 answer
userdata partially working but not installing boto3 on ec2 launch, have to explicitly install it
the userdata script for my ec2:
#!/bin/bash
curl https://raw.githubusercontent.com/erjan/MyVoteAWS/main/vote-processor/processor.py > /home/ec2-user/processor.py
cd /home/ec2-user/
sudo chmod +x processor.py
sudo yum -y install python3-pip
sudo yum…

ERJAN
- 23,696
- 23
- 72
- 146
1
vote
0 answers
Unable to change the Regional format for EC2 instance via User-Data script
I am trying to change the EC2 instance's Regional format setting:
to en-GB by running Set-Culture en-GB command in my user-data script:
# set timezone to GMT
tzutil /s "GMT Standard Time"
# set the date format to the UK -> dd/mm/yyyy…

Georgi Koemdzhiev
- 11,421
- 18
- 62
- 126
0
votes
0 answers
ssh-add in aws ec2 userdata script fails with permission denied error
I'm using the following script to bootstrap my AWS EC2 instances after launch. It runs without errors when I execute it manually after ssh-ing into the instance.
#!/bin/bash
set -eu
eval $(ssh-agent -s)
ssh-add ~/.ssh/my_github_deploy_key
git clone…

ack_inc
- 1,015
- 7
- 13
0
votes
0 answers
AWS EC2 Launch Template user-data don't work
I try to launch EC2 instance with a simple user-data set:
#!/bin/bash
sudo su -
sudo yum -y update
sudo yum install -y docker
sudo service docker start
sudo usermod -aG docker ec2-user
docker pull yeasy/simple-web
docker run -d --rm -it -p 80:80…

calm27
- 145
- 6
0
votes
0 answers
Gracefull shutdown doesn't work for processes started from user data script on ec2
I started an EC2 instance with a user data script.
This script initiates my application.
A graceful shutdown is implemented in the application (an HTTP request is sent upon receiving SIGTERM).
I stop/reboot/terminate the EC2 instance.
Expected:
The…

Grachev Alexey
- 1
- 1
0
votes
0 answers
Windows EC2 userdata powershell script run as administrator
Need help to run a powershell userdata script as administrator during the start up of instance.
sample code i used is
net.exe session 1>NUL 2>NUL || (powershell "Start-Process -FilePath Cmd.exe -ArgumentList \"/c %~dpnx0\" -Verb RunAs"…

Springhills
- 360
- 1
- 5
- 12
0
votes
0 answers
How install and run latest Apache and PHP Server over EC2 user data PowerShell script for window instance
I am beginner to this PowerShell script.
Please help me with this as I got stuck here.
I'm using this user data given below in ec2 window instance launch config So,
how can we proceed here can we get the same way as we are getting in code deployment…

Sujal
- 101
- 1
- 11