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
已提问 5 年前3234 查看次数
2 回答
0
已接受的回答

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
已回答 5 年前
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
已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则