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.
How do I fetch that ?
Open the Amazon Connect console at https://console.aws.amazon.com/connect/ . On the instances page, choose the instance alias. The instance alias is also your instance name, which appears in your Amazon Connect URL. On the Account overview page, in the Distribution settings section, you can see the full instance ARN.
To find the Amazon Resource Name (ARN) of the KMS key, choose the key ID or alias. The key ARN appears in the General Configuration section.
To get an ARN from the AWS Management Console, navigate to the resource you want an ARN for, and view the details for that resource. For example, you can get the ARN for a DB instance from the Configuration tab of the DB instance details, as shown following.
Amazon Resource Names (ARNs) uniquely identify AWS resources. We require an ARN when you need to specify a resource unambiguously across all of AWS, such as in IAM policies, Amazon Relational Database Service (Amazon RDS) tags, and API calls.
You can "build" it yourself:
arn:aws:ec2:<REGION>:<ACCOUNT_ID>:instance/<instance-id>
.
For this purpose, I think you can even use *
as <REGION>
and <ACCOUNT_ID>
, and it will work.
To retrieve the <instance_id>
you can use the Console or the CLI, or from within the instance itself with ec2metadata --instance-id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With