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年前3241ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ