且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 AWS 中获取 EC2 实例的 arn

更新时间:2022-11-07 13:03:48

您可以自己构建"它:

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