Use CLI to see "user data"?

0

Hello!

I start instances using the --user-data command line option. From inside the running instance, I've had no trouble getting that data and using it.

I have an external process that's attempting to monitor the instances involved in a certain job. I've used "aws ec2 describe-instances" to get all of the information I need. Well, almost all of it. I really need to see the user-data, so I can figure out exactly what workset a given instance is working on. I can't seem to find it.

The result of "aws ec2 describe-instances --instance-ids xxxx" doesn't contain the user data. If it is possible to get the user data, I'm guessing it would be a specific query string, but I can't find any reference to user data in the documentation.

Is it possible to use describe-instances to get the user data metadata?

Thanks,

Kevin

Kevin
asked 5 years ago3174 views
2 Answers
0
Accepted Answer

Hello

to get the instance user data, you can try the describe instance attribute
aws ec2 describe-instance-attribute --instance-id <InstanceID> --attribute userData
where <InstanceID> is your instance id

https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instance-attribute.html

hope this helps
RT

rtt
answered 5 years ago
0

Great! I hadn't found that. That gives me an encoded text blob, which when base64 decoded, gives me the data!

Thanks!

Kevin

Kevin
answered 5 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions