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
feita há 5 anos3238 visualizações
2 Respostas
0
Resposta aceita

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
respondido há 5 anos
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
respondido há 5 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas