imagebuilder / Client / update_infrastructure_configuration

update_infrastructure_configuration

imagebuilder.Client.update_infrastructure_configuration(**kwargs)

Updates an infrastructure configuration. An infrastructure configuration defines the environment in which Image Builder builds and tests your image.

Note

This operation doesn’t support selective updates. The request replaces the configuration, so include every setting that you want to keep. Omitted optional properties are cleared.

See also: AWS API Documentation

Request Syntax

response = client.update_infrastructure_configuration(
    infrastructureConfigurationArn='string',
    description='string',
    instanceTypes=[
        'string',
    ],
    instanceProfileName='string',
    securityGroupIds=[
        'string',
    ],
    subnetId='string',
    logging={
        's3Logs': {
            's3BucketName': 'string',
            's3KeyPrefix': 'string'
        }
    },
    keyPair='string',
    terminateInstanceOnFailure=True|False,
    snsTopicArn='string',
    resourceTags={
        'string': 'string'
    },
    instanceMetadataOptions={
        'httpTokens': 'string',
        'httpPutResponseHopLimit': 123
    },
    placement={
        'availabilityZone': 'string',
        'tenancy': 'default'|'dedicated'|'host',
        'hostId': 'string',
        'hostResourceGroupArn': 'string'
    },
    clientToken='string'
)
Parameters:
  • infrastructureConfigurationArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the infrastructure configuration that you want to update.

  • description (string) – The description of the infrastructure configuration.

  • instanceTypes (list) –

    The instance types of the infrastructure configuration. You can specify one or more instance types to use for this build. Image Builder picks one of these instance types based on availability. If you don’t specify instance types, Image Builder selects compatible instance types automatically. If you specify a Dedicated Host, Image Builder uses only instance types that the host supports.

    • (string) –

  • instanceProfileName (string) –

    [REQUIRED]

    The instance profile to associate with the instance used to customize your Amazon EC2 AMI. The instance profile must exist in your account.

  • securityGroupIds (list) –

    The security group IDs to associate with the instance used to customize your Amazon EC2 AMI.

    • (string) –

  • subnetId (string) – The subnet ID in which to place the instance used to customize your Amazon EC2 AMI. If you specify subnetId, you must also specify one or more security group IDs in securityGroupIds. Otherwise, the request fails.

  • logging (dict) –

    The logging configuration of the infrastructure configuration. When you configure S3 logs, Image Builder writes logs from the build and test process to the specified bucket under the key prefix.

    • s3Logs (dict) –

      The Amazon S3 logging configuration.

      • s3BucketName (string) –

        The name of an existing Amazon S3 bucket where Image Builder saves build logs. The bucket isn’t validated when you create or update the configuration, and Image Builder doesn’t create it. The instance profile associated with this infrastructure configuration must have permission to write to the bucket.

      • s3KeyPrefix (string) –

        The Amazon S3 key prefix under which Image Builder writes build and test logs in the bucket.

  • keyPair (string) – The key pair of the infrastructure configuration. You can use this to log on to and debug the instance used to create your image.

  • terminateInstanceOnFailure (boolean) – Specifies whether to terminate the instance on failure. Set to false if you want Image Builder to retain the instance used to configure your AMI if the build or test phase of your workflow fails. Defaults to true.

  • snsTopicArn (string) –

    The Amazon Resource Name (ARN) of the SNS topic to which Image Builder sends image build event notifications. Specify a standard topic. Image Builder doesn’t support FIFO topics. Image Builder validates the topic when you create or update the configuration. You must have permission to publish to the topic.

    Note

    EC2 Image Builder can’t send notifications to SNS topics that are encrypted using keys from other accounts. If your SNS topic is encrypted, the key must be owned by the same account that owns your Image Builder resources.

  • resourceTags (dict) –

    The metadata tags to assign to the Amazon EC2 instance that Image Builder launches during the build process. Tags are formatted as key value pairs. Tag keys can’t begin with aws: or match one of the following reserved keys: CreatedBy, Ec2ImageBuilderArn, Name, or Tags.

    • (string) –

      • (string) –

  • instanceMetadataOptions (dict) –

    The instance metadata service (IMDS) settings that Image Builder applies to the EC2 build and test instances it launches during image creation. If you don’t set these options, the EC2 launch defaults for the instance apply. For more information about instance metadata options, see one of the following links:

    • httpTokens (string) –

      Indicates whether a signed token header is required for instance metadata retrieval requests. The values affect the response as follows:

      • required – When you retrieve the IAM role credentials, version 2.0 credentials are returned in all cases.

      • optional – You can include a signed token header in your request to retrieve instance metadata, or you can leave it out. If you include it, version 2.0 credentials are returned for the IAM role. Otherwise, version 1.0 credentials are returned.

      If you don’t set a value, the EC2 launch default applies to the build and test instances. That default depends on the base AMI and any account-level instance metadata defaults. For more information, see Configure the instance metadata options in the Amazon EC2 User Guide .

    • httpPutResponseHopLimit (integer) –

      Limit the number of hops that an instance metadata request can traverse to reach its destination. If you don’t set a value, the EC2 launch default for the instance applies. If HTTP tokens are required, container image builds need a minimum of two hops.

  • placement (dict) –

    The instance placement settings that define where the build and test instances that Image Builder launches during image creation run. These settings don’t affect instances that you launch from the output image.

    • availabilityZone (string) –

      The Availability Zone where your build and test instances will launch.

    • tenancy (string) –

      The tenancy of the instance. An instance with a tenancy of dedicated runs on single-tenant hardware. An instance with a tenancy of host runs on a Dedicated Host.

      If tenancy is set to host, then you can optionally specify one target for placement – either host ID or host resource group ARN. If automatic placement is enabled for your host, and you don’t specify any placement target, Amazon EC2 will try to find an available host for your build and test instances.

    • hostId (string) –

      The ID of the Dedicated Host on which build and test instances run. This only applies if tenancy is host.

    • hostResourceGroupArn (string) –

      The Amazon Resource Name (ARN) of the host resource group in which to launch build and test instances. This only applies if tenancy is host.

  • clientToken (string) –

    [REQUIRED]

    A unique, case-sensitive identifier you provide to ensure that the operation runs no more than one time. If you retry a request with the same client token, Image Builder returns the original response without running the operation again. For more information, see Ensuring idempotency in the Amazon EC2 API Reference.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'requestId': 'string',
    'clientToken': 'string',
    'infrastructureConfigurationArn': 'string'
}

Response Structure

  • (dict) –

    • requestId (string) –

      The request ID that uniquely identifies this request.

    • clientToken (string) –

      The client token that uniquely identifies the request.

    • infrastructureConfigurationArn (string) –

      The Amazon Resource Name (ARN) of the infrastructure configuration that was updated by this request.

Exceptions

  • imagebuilder.Client.exceptions.ServiceException

  • imagebuilder.Client.exceptions.ClientException

  • imagebuilder.Client.exceptions.ServiceUnavailableException

  • imagebuilder.Client.exceptions.InvalidRequestException

  • imagebuilder.Client.exceptions.IdempotentParameterMismatchException

  • imagebuilder.Client.exceptions.ForbiddenException

  • imagebuilder.Client.exceptions.CallRateLimitExceededException

  • imagebuilder.Client.exceptions.ResourceInUseException