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
gefragt vor 5 Jahren3242 Aufrufe
2 Antworten
0
Akzeptierte Antwort

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
beantwortet vor 5 Jahren
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
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen