Questions tagged [cloud-init]

CloudInit is a set of python scripts and utilities that handles initialization and configuration of cloud instances. It is installed in the Ubuntu Cloud Images and also in the official Ubuntu images available on EC2.

CloudInit is a set of python scripts and utilities that handles initialization and configuration of cloud instances. It is installed in the Ubuntu Cloud Images and also in the official Ubuntu images available on EC2.

387 questions
14
votes
2 answers

Cloud-init validator

Wondering if anyone knows of a validator that can validate cloud-init config similar to this. We tried it and it gives a bunch of errors that are not applicable e.g., it does not recognize package_update which is a standard keyword that can be found…
morpheus
  • 18,676
  • 24
  • 96
  • 159
13
votes
4 answers

user-data (cloud-init) script not executing on EC2

my user-data script #! set -e -x echo `whoami` su root yum update -y touch ~/PLEASE_WORK.txt which is fed in from the command: ec2-run-instances ami-05355a6c -n 1 -g mongo-group -k mykey -f myscript.sh -t t1.micro -z us-east-1a but when I check…
lollercoaster
  • 15,969
  • 35
  • 115
  • 173
12
votes
1 answer

/var/log/cloud-init-output.log is not present on RHEL 7.5

I've got a custom hardended RHEL 7.5 custom AMI. I want to use user data to complete some deploy time configuration. I've already ensured that /var/lib/cloud/* is removed before I create the AMI. These are the contents of my user data: echo "My…
Josh Kodroff
  • 27,301
  • 27
  • 95
  • 148
12
votes
1 answer

What user does cloud-config run as?

When spinning up an AWS or other cloud vendor instance, and using cloud-init to configure the host, what user do bash scripts that get called run as?
J0hnG4lt
  • 4,337
  • 5
  • 24
  • 40
12
votes
1 answer

When is cloud-init run and how does it find its data?

I'm currently dealing with CoreOS, and so far I think I got the overall idea and concept. One thing that I did not yet get is execution of cloud-init. I understand that cloud-init is a process that does some configuration for CoreOS. What I do not…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
12
votes
2 answers

Can IAM role temporary credentials be used in cloudformation templates?

I'm building a stack that needs access to a private S3 bucket to download the most current version of my application. I'm using IAM roles, a relatively new AWS feature that allows EC2 instances to be assigned specific roles, which are then coupled…
10
votes
1 answer

Ubuntu Focal headless setup on Raspberry pi 4 - cloud init wifi initialisation before first reboot

i'm having trouble in setting up a full headless install for Ubuntu Server Focal (ARM) on a Raspberry pi 4 using cloud init config. The whole purpose of doing this is to simplify the SD card swap in case of failure. I'm trying to use cloud-init…
DragosN
  • 101
  • 1
  • 3
10
votes
2 answers

How do you make Terraform wait for cloud-init to finish?

In my Terraform AWS Docker Swarm module I use cloud-init to initialize the EC2 instance. However, Terraform says the resource is ready before cloud-init finishes. Is there a way of making it wait for cloud-init to finish, ideally without SSHing or…
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
10
votes
6 answers

How do I set a custom password with Cloud-init on Ubuntu 20.04?

Recently I've gotten Cloud-Init to work by mounting my config in an image. This is all fine, it works. If I break the config, it tells me. What it doesn't tell me is why I'm not allowed to log on. What I've tried is creating my own password using…
Mies van der Lippe
  • 492
  • 1
  • 3
  • 13
9
votes
1 answer

Using a pipe in cloud init runcmd fails

How can I use a pipe to redirect the output of a command in my runcmd section of my cloud init script? The following fails: runcmd: - [curl, -sk, https://example.com/packages/current/install.bash, '|', /bin/bash, -s, agent:certname=XYZ.com]…
anish
  • 6,884
  • 13
  • 74
  • 140
9
votes
3 answers

Proper syntax of write_files directive in cloud config?

I'm trying to get a cloud config script working properly with my DigitalOcean droplet, but I'm testing on local lxc containers in the interim. One consistent problem I have is that I can never get the write_files directive working properly for more…
Julian H. Lam
  • 25,501
  • 13
  • 46
  • 73
8
votes
3 answers

How to set hostname with cloud-init and Terraform?

I am starting with Terraform. I am trying to make it set a friendly hostname, instead of the usual ip-10.10.10.10 that AWS uses. However, I haven't found how to do it. I tried using provisioners, like this: provisioner "local-exec" { command =…
ilvidel
  • 322
  • 1
  • 4
  • 13
8
votes
5 answers

how to add crontab scheduler through user-data script in aws ec2?

I am trying to add a crontab so that I can get the cloudwatch metrics of diskspace used and disk space utilization every 5 minutes through a user data script. Below is my user-data script: #!/bin/bash sudo yum install -y perl-Switch perl-DateTime…
Vatsal Rahul
  • 347
  • 1
  • 4
  • 19
8
votes
2 answers

cloudinit how to schedule a periodic task while bootstrapping a vm

While creating vm using Nova boot I am supplying it a user-data script (cloud-init script). what I am wondering is, how can I specify in that cloud init script( or any other way to do it) :- to schedule a cron job to run every 2 hours lets say I…
user2574872
  • 945
  • 2
  • 11
  • 23
7
votes
1 answer

in AWS, is user_data executed before cloud-init?

I use terraform to create an EC2 instance, and I use user_data to place a file in /var/lib/cloud/scripts/per-once. This is not executed - my question now is: is cloud-init run before user_data? ===EDIT=== A longer reply to Dude0001's very helpful…
j4nd3r53n
  • 680
  • 2
  • 11
  • 26
1
2
3
25 26