Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageBuilder: InvalidParameterValueException thrown for valid Arn #2224

Closed
Ashex opened this issue Dec 5, 2019 · 5 comments
Closed

ImageBuilder: InvalidParameterValueException thrown for valid Arn #2224

Ashex opened this issue Dec 5, 2019 · 5 comments
Assignees
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@Ashex
Copy link

Ashex commented Dec 5, 2019

An arn retrieved via the list_components operation throws an exception when passed to get_component:

import boto3
imagebuilder = boto3.client('imagebuilder')
for component in imagebuilder.list_components(owner='Amazon')['componentVersionList']:
    imagebuilder.get_component(componentBuildVersionArn=component['arn'])

Traceback (most recent call last):
  File "<input>", line 2, in <module>
  File "/Users/ahmed/pyenv/cloud-tools36/lib/python3.6/site-packages/botocore/client.py", line 272, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/ahmed/pyenv/cloud-tools36/lib/python3.6/site-packages/botocore/client.py", line 576, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the GetComponent operation: The value supplied for parameter 'componentBuildVersionArn' is not valid. 'componentBuildVersionArn' must match pattern ^arn:aws[^:]*:imagebuilder:[^:]+:(?:\d{12}|aws):component/[a-z0-9-_]+/\d+\.\d+\.\d+/\d+$

Component arn returned from list_components:
arn:aws:imagebuilder:eu-west-1:aws:component/python-3-linux/1.0.0

Component arn returned from create_component:
arn:aws:imagebuilder:eu-west-1:01234567890:component/foo/0.0.13/1

It's not clear what the /1 suffix is for.

Interestingly, I can create an Image Recipe with a mix of these Arns and validation passes. The pipeline created with this recipe successfully generates an image.

Reproduced on boto3 1.10.33 and 1.10.34

@klaytaybai
Copy link

Try appending "/1" to the ARNs you get back. I haven't been able to find resources to identify what that /1 is supposed to represent. You can't create a /2 version with the same semantic-version, so I'm not sure why it's there. The ARN regexes seem to require it even though the ARNs aren't always represented with that extra digit.

@Ashex
Copy link
Author

Ashex commented Dec 6, 2019

I noticed the same. The console shows arns with the /1 suffix, adding that allows get_component to succeed.

Interestingly, create_component returns the arn with the /1 suffix.

@Ashex
Copy link
Author

Ashex commented Dec 6, 2019

The same issue exists for Image Arns:

for image in imagebuilder.list_images(owner='Self')['imageVersionList']:
    imagebuilder.delete_image(imageBuildVersionArn=image['arn'])
    
Traceback (most recent call last):
  File "<input>", line 2, in <module>
  File "/Users/ahmed/pyenv/cloud-tools36/lib/python3.6/site-packages/botocore/client.py", line 272, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/ahmed/pyenv/cloud-tools36/lib/python3.6/site-packages/botocore/client.py", line 576, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the DeleteImage operation: The value supplied for parameter 'imageBuildVersionArn' is not valid. 'imageBuildVersionArn' must match pattern ^arn:aws[^:]*:imagebuilder:[^:]+:(?:\d{12}|aws):image/[a-z0-9-_]+/\d+\.\d+\.\d+/\d+$

@diehlaws diehlaws added the guidance Question that needs advice or information. label Dec 6, 2019
@swetashre swetashre assigned swetashre and unassigned klaytaybai Dec 11, 2019
@swetashre
Copy link
Contributor

@Ashex - Thank you for your post. You have to pass the arn, got from list_components to list_components_build_versions and then use that arn with get_component call. Something like this:

import boto3
imagebuilder = boto3.client('imagebuilder')

for component in imagebuilder.list_components(owner='Self')['componentVersionList']: 
           print(component['arn']) 

arn:aws:imagebuilder:us-west-2:123456789:component/test-component/1.1.1

Then use this arn with list_component_build_versions

imagebuilder.list_component_build_versions(componentVersionArn='arn:aws:imagebuilder:us-west-2:123456789:component/test-component/1.1.1')


'componentSummaryList': [{'arn': 'arn:aws:imagebuilder:us-west-2:123456789:component/test-component/1.1.1/1',
   'name': 'test_component',
   'version': '1.1.1',
   'platform': 'Linux',
   'type': 'TEST',
   'owner': '504809190933',
   'dateCreated': '2019-12-11T18:53:04.937Z',
   'tags': {}}]}

Now you can use this arn with get_component api call

imagebuilder.get_component(componentBuildVersionArn='arn:aws:imagebuilder:us-west-2:123456789:component/test-component/1.1.1/1') 

It is same for image_versions and image_build_versions. Each time a pipeline creates an image, it is creating a new image build version (example: /1, /2, etc.). So with image_versions the arn of all image of a pipeline will be same and in that case you have to use image_build_versionsto get the particular arn.

Hope it helps.

@swetashre swetashre added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Dec 11, 2019
@no-response
Copy link

no-response bot commented Dec 18, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

4 participants