amazon ec2 - Is there anyway to access values from the EC2 tags in cloud-init -


i know can access tags via metadata , cli tools, there anyway access them whilst running cloud-init? ideally i'd tag called hostname , use set machine host name.

thanks

this command can run userdata (or time, really) access instance id metadata, , use pull tag called "hostname". assign variable, or use output directly set hostname of instance.

aws ec2 describe-instances --output text --query 'reservations[*].instances[*].tags[?key==`hostname`].value' --instance-id `curl -s http://169.254.169.254/latest/meta-data/instance-id` 

Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -