Search code examples
pythonamazon-web-servicesamazon-ec2boto3aws-sam

Boto3: trying to add launch permission to AMI for an organizational unit raises ParamValidationError


Following the documentation of boto3 ec2, I'm trying to extend the launch permissions of a custom built AMI to allow an organizational unit.

arns = [string list of arns]
for arn in arns:
        r = ec2.modify_image_attribute(
            ImageId=image['ImageId'],
            LaunchPermission={
                'Add': [
                    {
                        'OrganizationalUnitArn': arn
                    },
                ],
            }
        )

Running the above code I get the following error:

botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in LaunchPermission.Add[0]: "OrganizationalUnitArn", must be one of: Group, UserId

The ARN is supplied as a string, and the code itself was directly copied from the documentation. What's causing the error?


Solution

  • My local boto3 package was simply outdated, upgrading it fixed the problem.