Questions tagged [ec2-userdata]

42 questions
0
votes
1 answer

Windows EC2 User data script not working as expected

I'm trying to detach an EBS volume from an EC2 instance and attach it to a new EC2 instance which I'm starting up using a CloudFormation template(YAML). Below is the UserData section. I use a timeout command to give time for the EBS volume to…
0
votes
0 answers

Insufficient permissions when running Set-AdComputer command through AWS EC2(windows) userdata script

I am attempting to update EC2 instances' AD OU (Computer Object) attributes through ec2 userdata script. I am seeing "Message: The errors from user data script: Set-AdComputer : Insufficient access rights to perform the operation" which isn't making…
0
votes
3 answers

Individualize user-data in an AWS autoscaling group

I would like to get some sort of ordinal number for each instance in an auto-scaling group. Let's say that group have 5 instances maximum. I would like to have a number 0, 1, 2, 3, 4 or 1, 2, 3, 4, 5 assigned to each running member of that…
Gunther Schadow
  • 1,490
  • 13
  • 22
0
votes
1 answer

AWS EC2 user data: run python script at startup as non-root user

When my EC2 VM (Ubuntu) starts, I'd like it to execute a python script myscript.py as ec2-user instead of the default root user. This includes using the ec2-user's python executable, installed packages and binaries (e.g. chromedriver) How can I do…
Dr-Nuke
  • 368
  • 3
  • 11
0
votes
2 answers

Terraform loop for files in folder

In terraform, I'm using user_data to initiate a windows server instance. Locally, I have a folder with several files. Each file contains a single line. In my user_data PowerShell script, I would like to create a single file containing the…
iAmoric
  • 1,787
  • 3
  • 31
  • 64
0
votes
0 answers

Unable to bootstrap EC2 server with user data

I am creating an AWS EC2 t2.micro and using the below user data. I added the condition to check for the presence of the "BootstrapCompleted " file and run updates AFTER that. #!/bin/bash while  [  ! -f /tmp/BootstrapCompleted ] do …
learner
  • 2,480
  • 10
  • 50
  • 94
0
votes
0 answers

EC2 User data not formatting bash variables

I have a line in my ec2 instance user data that is seen below cat <> $HOME/.bashrc export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export HADOOP_HOME=$HOME/hadoop export HADOOP_CONF=$HADOOP_HOME/etc export…
Temmyzeus
  • 36
  • 2
0
votes
2 answers

terraform not updating content from user-data file

I have a user-data file attached to the main.tf. Whenever I make changes to the user-data file, and then run the terraform apply, the changes do not reflect on the server until I destroy and recreate the resources. Please is this the default…
0
votes
0 answers

Unable to schedule a task in aws windows ec2 using user data

I have a windows user data script that references a bunch of other ps1 scripts. In one of the scripts I am trying to schedule a job, that will run on start up. This job has an action of triggering another ps1 script on startup. However, all my other…
0
votes
0 answers

powershell script throwing cmd not found error for powershell tag

I am trying to run a user-data script for aws ec2 windows instance. I added this line in my main.tf user_data = data.template_file.user_data.rendered then I have defined this in data module as template file : data "template_file"…
0
votes
0 answers

How to install Microsoft SQL server as userdata(powershell) on windows machine in AWS? or powershell error resolution for below

Its and windows machine and trying to install Sql Server(unattended) using powershell Write-Host "`nStarting the install of SQL Server" -ForegroundColor Green [string]$userName = 'domain\username' [string]$userPassword = 'xyz' …
0
votes
0 answers

The EC2 user_data script dos not run

Hi i'm stuck with my user_data script because the script is no executed by the ec2 and i don't really understand why On terraform i have resource "aws_instance" "ec2_b" { ami = "ami-0c2b8ca1dad447f8a" instance_type = "t2.micro" subnet_id…
0
votes
1 answer

Cloudformation template in YAML is failing to parse the user data powershell script

I have written a cloudformation template in YAML, and everything runs smoothly but now instead of manually going into powershell to add a local group member and install some windows features I want to add the powershell commands to the user data…
0
votes
1 answer

Aws ec2 user data script not working on start up

I am trying to run a script on my EC2 at startup, with an image I created that runs ubuntu. However, the script is failing although when I connect through ssh and run the script it is working. My user data is: #!/bin/bash echo…
mr_robot
  • 415
  • 1
  • 5
  • 16
0
votes
0 answers

Trying to install cloudwatch agent in windows server with userdata

Trying to install CloudWatch agent in windows server with userdata in CloudFormation stack. Couldn't see the agent running. can someone post the CloudWatch agent userdata script for windows server. I have written the following…