Skip to content

AMI tags not shared between accounts #353

Description

@wking

Spun off from discussion in #314, which landed the tags. Here are two acounts, rh-dev and the one we use for CI:

$ AWS_PROFILE=rh-dev aws sts get-caller-identity --query Account --output text
531415883065
$ AWS_PROFILE=ci aws sts get-caller-identity --query Account --output text
460538899914

rh-dev sees alpha tags on AMIs, while CI does not:

$ AWS_PROFILE=rh-dev AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --filters "Name=tag:rhcos_tag,Values=alpha" --query 'sort_by(Images, &CreationDate)[-1].Name' --output text
rhcos_dev_4.0.6562-hvm
$ AWS_PROFILE=ci AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --filters "Name=tag:rhcos_tag,Values=alpha" --query 'sort_by(Images, &CreationDate)[-1].Name' --output text
None

Get the actual AMI ID:

$ AWS_PROFILE=rh-dev AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --filters "Name=tag:rhcos_tag,Values=alpha" --query 'sort_by(Images, &CreationDate)[-1].ImageId' --output text
ami-0a08f82608c65f0bc

The AMI is public:

$ AWS_PROFILE=rh-dev AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-image-attribute --image-id ami-0a08f82608c65f0bc --attribute launchPermission --output text
ami-0a08f82608c65f0bc
LAUNCHPERMISSIONS  all

But I can't describe it from the CI account:

$ AWS_PROFILE=ci AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-image-attribute --image-id ami-0a08f82608c65f0bc --attribute launchPermission --output text

An error occurred (AuthFailure) when calling the DescribeImageAttribute operation: Not authorized for image:ami-0a08f82608c65f0bc

The AMI is there for listing:

$ AWS_PROFILE=ci AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --image-ids ami-08b37b9b9700f5a0d --query Images[].Name --output text
rhcos_dev_4.0.6554-hvm

Comparing the descibe-images output between accounts:

$ alias get='AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images --image-ids ami-08b37b9b9700f5a0d --query Images[0] --output json'
$ diff -u <(AWS_PROFILE=rh-dev get) <(AWS_PROFILE=ci get)
--- /dev/fd/632018-10-05 11:18:12.323494210 -0700
+++ /dev/fd/622018-10-05 11:18:12.323494210 -0700
@@ -1,24 +1,6 @@
 {
     "VirtualizationType": "hvm",
     "Description": "Red Hat CoreOS 4.0.6554 (eca924619ba62e615665c6dfda32a12593edb331277aed113ae9217d44746ffd)",
-    "Tags": [
-        {
-            "Value": "alpha",
-            "Key": "rhcos_tag"
-        },
-        {
-            "Value": "rhcos_dev_4.0.6554-hvm",
-            "Key": "Name"
-        },
-        {
-            "Value": "4.0.6554",
-            "Key": "ostree_version"
-        },
-        {
-            "Value": "eca924619ba62e615665c6dfda32a12593edb331277aed113ae9217d44746ffd",
-            "Key": "ostree_commit"
-        }
-    ],
     "Hypervisor": "xen",
     "EnaSupport": true,
     "SriovNetSupport": "simple",

So why are those tags not visible to me in the CI account?

CC @miabbott

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions