如何在 AWS 中获取 EC2 实例的 arn [英] How to get arn of EC2 instance in AWS

查看:37
本文介绍了如何在 AWS 中获取 EC2 实例的 arn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 AWS 中获取 ec2 实例的 arn.我正在尝试使用资源标签 api 将标签添加到 EC2 实例.资源标签 api 需要所有资源的 arn.

How do I get the arn of ec2 instance in AWS. I am trying to use resource tag api to add the tags to an EC2 instance. Resource tag api requires arn for all the resources.

我如何获取它?

推荐答案

您可以自己构建"它:

arn:aws:ec2:::instance/.

为此,我认为您甚至可以使用 * 作为 ,它会起作用.

For this purpose, I think you can even use * as <REGION> and <ACCOUNT_ID>, and it will work.

要检索 <instance_id>,您可以使用控制台或 CLI,或者从实例本身使用 ec2metadata --instance-id

To retrieve the <instance_id> you can use the Console or the CLI, or from within the instance itself with ec2metadata --instance-id

这篇关于如何在 AWS 中获取 EC2 实例的 arn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆