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
4
votes
2 answers

How to spin up a docker container (or docker-compose) with cloud-init (cloud-config)

I try to spin up a server which should run docker and docker-compose with a simple "hello-world" container. My YAML file looks like this: #cloud-config ssh_authorized_keys: - ssh-rsa MY_SSH_KEY_HERE package_update: true package_upgrade:…
Jan
  • 12,992
  • 9
  • 53
  • 89
4
votes
2 answers

How can i re run user data on aws ec2 from the console?

I would like to ask if there is a way to re-execute user data on a launched instance. I want to restart a service and to edit ~./ssh/autorized_keys. I found information at…
Zambozo
  • 456
  • 4
  • 12
4
votes
1 answer

User data not being execute by cloud-init

I am trying to get an Ubuntu Cloud Image (specifically ami-311a1a5b) to bootstrap docker after being launched by terraform. I have the following configuration for doing this: resource "aws_instance" "app" { count = 1 ami = "${lookup(var.amis,…
rainkinz
  • 10,082
  • 5
  • 45
  • 73
4
votes
1 answer

Pass IP-address to cloud-init metadata

I am searching for a way to pass a ip-address to cloud-init metadata. So when my qcow boots, it does not have to wait for 120 - 180 seconds to boot. Currently I've created a workaround by adding IP-address information to the userdata part of…
Jonas Libbrecht
  • 768
  • 1
  • 8
  • 17
4
votes
0 answers

cloud-init: Failed to write hostname XXXX to /var/lib/cloud/data/previous-hostname

I'm trying to set my Bluemix VM's hostname with a cloud-init script, but it's throwing an error: cloud-init[1143]: Cloud-init v. 0.7.5 running 'init' at Sun, 27 Sep 2015 13:14:39 +0000. Up 66.82 seconds. cloud-init[1143]: ci-info:…
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
4
votes
1 answer

AWS EC2 RHEL 7.1 console output doesn't show cloud-init's output

It seems that the instances started from RHEL 7.1 AMIs does not write the SSH fingerprint into the system log (exactly nothing from cloud-init's output), therefore I can't use the 'Get System Log' menu on AWS UI or the command line tool to figure…
4
votes
2 answers

CoreOS AWS Cloudinit Issue

I'm trying to setup EC2 instances using CoreOS stable AMI with some custom cloud-init config but having some issues. #cloud-config coreos: etcd: discovery: https://discovery.etcd.io/5996f1b49fd642c5d1bc2f62cbff2fba addr:…
oBa
  • 411
  • 3
  • 12
4
votes
1 answer

cloud-init how to add default user to sudoers.d

I boot strap a centos 6.5 AMI with this user data: #cloud-config users: - default - name: my-user - sudo: ALL=(ALL) NOPASSWD:ALL My machine comes up with the user cloud-user as the default user, not my-user. My public key has been copied to…
Jepper
  • 1,092
  • 3
  • 11
  • 24
3
votes
0 answers

EC2 user data unable to run python script?

I am creating an ec2 instance via terraform and trying to run a python script via user data. and i am passing it into my ec2 instance like this : resource "aws_instance" "web" { ami = "ami-id" instance_type …
Somethingwhatever
  • 1,390
  • 4
  • 32
  • 58
3
votes
1 answer

Location of cloud-init user-data.yml file

I want to bootstrap some raspi nodes with cloud-init. As of now I am testing this with a vagrantbox running ubuntu/jammy64. My question now is: Where do I put my user-data.yml file so that cloud-init picks it up automatically omn the first startup?…
3
votes
0 answers

How Cloud-init can be stopped on first error

When I start a linux server with Cloud-init, I have a few scripts in /etc/cloud/cloud.cfg.d/ and they run in reverse alphabetical order # ll /etc/cloud/cloud.cfg.d/ total 28 -rw-r--r-- 1 root root 173 Dec 10 12:38…
chriscatfr
  • 2,592
  • 3
  • 24
  • 32
3
votes
1 answer

Terraform only runs the first part of multi-part user data

I am looking into setting up VM infrastructure using Terraform and initiatize the VM using cloud-init. I am trying multipart approach using cloud-config content type for the first part, shellscript for the second part. However, upon terraform apply,…
zaidwaqi
  • 609
  • 1
  • 8
  • 25
3
votes
0 answers

Cloud-init per-boot scripts in cloud/scripts/per-boot

I am trying to put my script file (script.sh) in the /var/lib/cloud/scripts/per-boot/ directory, so that the cloud-init runs the script every time my VPS boots. But the problem is the script is not getting executed when the VPS boots. Not even…
3
votes
1 answer

Set hostname on CentOS using cloud-init

I want to use generic configuration in my cloud config file, to manually set the hostname for the deployed OS. cloud-init's "hostname" works just fine for ubuntu images, but cant get it to work for Centos cloud images(CentOS 7.8) to be specific. I…
Arun Nalpet
  • 1,190
  • 1
  • 9
  • 20
3
votes
1 answer

How to run and test Cloud-init locally?

Recently, I have been provisioning cloud servers using Cloud-init. I like it and it is sufficient for my usecase which is simple configuration management. To run and test Cloud-init scripts, I always have to spin up a new cloud instance and wait for…
Ashish Bista
  • 4,533
  • 1
  • 18
  • 25