Skip to content

create_image_pipeline async

create_image_pipeline(
    name: ResourceName,
    infrastructure_configuration_arn: InfrastructureConfigurationArn,
    client_token: ClientToken,
    *,
    config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
    description: Optional[NonEmptyString] = None,
    image_recipe_arn: Optional[ImageRecipeArn] = None,
    container_recipe_arn: Optional[ContainerRecipeArn] = None,
    distribution_configuration_arn: Optional[DistributionConfigurationArn] = None,
    image_tests_configuration: Optional[ImageTestsConfiguration] = None,
    enhanced_image_metadata_enabled: Optional[NullableBoolean] = None,
    schedule: Optional[Schedule] = None,
    status: Optional[PipelineStatus] = None,
    tags: Optional[TagMap] = None,
    image_tags: Optional[TagMap] = None,
    image_scanning_configuration: Optional[ImageScanningConfiguration] = None,
    workflows: Optional[WorkflowConfigurationList] = None,
    execution_role: Optional[RoleNameOrArn] = None,
    logging_configuration: Optional[PipelineLoggingConfiguration] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateImagePipelineResponse

Creates a new image pipeline. Use image pipelines to automate the creation and distribution of images. You must specify exactly one recipe for the pipeline, using either a containerRecipeArn or an imageRecipeArn.

Parameters:

  • name (ResourceName) –

    The name of the image pipeline. Pipeline names must be unique to your account in each Amazon Web Services Region. Image Builder generates the pipeline ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name.

  • description (Optional[NonEmptyString], default: None ) –

    The description of the image pipeline.

  • image_recipe_arn (Optional[ImageRecipeArn], default: None ) –

    The Amazon Resource Name (ARN) of the image recipe that configures images created by this image pipeline. You must specify either this property or containerRecipeArn, but not both.

  • container_recipe_arn (Optional[ContainerRecipeArn], default: None ) –

    The Amazon Resource Name (ARN) of the container recipe that is used to configure images created by this container pipeline. You must specify either this property or imageRecipeArn, but not both.

  • infrastructure_configuration_arn (InfrastructureConfigurationArn) –

    The Amazon Resource Name (ARN) of the infrastructure configuration that builds images created by this image pipeline.

  • distribution_configuration_arn (Optional[DistributionConfigurationArn], default: None ) –

    The Amazon Resource Name (ARN) of the distribution configuration that configures and distributes images created by this image pipeline.

  • image_tests_configuration (Optional[ImageTestsConfiguration], default: None ) –

    Specifies the test settings that Image Builder applies to images that this pipeline creates. If you don't provide test settings, Image Builder stores a default configuration with image tests enabled.

  • enhanced_image_metadata_enabled (Optional[NullableBoolean], default: None ) –

    Specifies whether to collect additional information about the image being created, including the operating system (OS) version and package list. Defaults to true.

  • schedule (Optional[Schedule], default: None ) –

    The schedule of the image pipeline. If you don't provide a schedule, the pipeline runs only when you call StartImagePipelineExecution.

  • status (Optional[PipelineStatus], default: None ) –

    The status of the image pipeline. If you don't specify a status, it defaults to ENABLED. A disabled pipeline doesn't run on its schedule, but you can still start builds manually.

  • tags (Optional[TagMap], default: None ) –

    The tags of the image pipeline.

  • image_tags (Optional[TagMap], default: None ) –

    The tags that Image Builder applies to the Image Builder image resource that this pipeline's scheduled executions create. These tags don't apply to the output AMI. To tag output AMIs, use amiTags in the pipeline's distribution configuration.

  • client_token (ClientToken) –

    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.

  • image_scanning_configuration (Optional[ImageScanningConfiguration], default: None ) –

    Contains settings for vulnerability scans that Amazon Inspector runs against the test instance during image creation.

  • workflows (Optional[WorkflowConfigurationList], default: None ) –

    The array of workflow configuration objects for builds that this pipeline starts. You must also specify executionRole when you provide workflows.

  • execution_role (Optional[RoleNameOrArn], default: None ) –

    The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.

  • logging_configuration (Optional[PipelineLoggingConfiguration], default: None ) –

    Specifies the logging configuration for the image pipeline. Use this to define custom CloudWatch Logs log groups for your pipeline execution logs and image build logs. The service manages log groups with names starting with /aws/imagebuilder/ using the service-linked role. For custom log group names outside of this prefix, you must also provide an executionRole.

  • dry_run (Optional[Boolean], default: None ) –

    Validates the required permissions and request parameters without performing the operation. If validation succeeds, the operation returns a DryRunOperationException error response.

Raises:

  • CallRateLimitExceededException –

    You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.

  • ClientException –

    A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.

  • DryRunOperationException –

    The dry run operation of the resource was successful, and no resources or mutations were actually performed due to the dry run flag in the request.

  • ForbiddenException –

    You are not authorized to perform the requested operation.

  • IdempotentParameterMismatchException –

    You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.

  • InvalidRequestException –

    The request is malformed or otherwise invalid. Verify the request and try again.

  • ResourceAlreadyExistsException –

    The resource that you are trying to create already exists.

  • ResourceInUseException –

    The resource that you are trying to operate on is currently in use. Review the message details and retry later.

  • ServiceException –

    An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.

  • ServiceQuotaExceededException –

    You have exceeded the number of permitted resources or operations for this service. For service quotas, see EC2 Image Builder endpoints and quotas.

  • ServiceUnavailableException –

    The service is unable to process your request at this time.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Create an image pipeline The following example creates a pipeline that builds a new image version every Sunday at 9:00 AM UTC, if the base image or components have updates.

>>> await client.create_image_pipeline(name='my-example-pipeline', description='Builds a new version of my image every Sunday', image_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0', infrastructure_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure', distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', schedule={'scheduleExpression': 'cron(0 9 ? * SUN *)', 'pipelineExecutionStartCondition': 'EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE'}, status='ENABLED', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE55555')
Create an image pipeline with scanning, custom workflows, and an auto-disable policy
The following example creates a pipeline that uses your custom build workflow and enables image scanning. The schedule evaluates its cron expression in the America/Los_Angeles time zone. The auto-disable policy disables the pipeline after 3 consecutive failed scheduled builds.
>>> await client.create_image_pipeline(name='my-example-pipeline', description='Builds a scanned image with my custom build workflow on Sunday mornings when dependency updates are available', image_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.1.0', infrastructure_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure', distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', workflows=[{'workflowArn': 'arn:aws:imagebuilder:us-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1'}], execution_role='arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder', image_scanning_configuration={'imageScanningEnabled': True}, schedule={'scheduleExpression': 'cron(0 9 ? * SUN *)', 'timezone': 'America/Los_Angeles', 'pipelineExecutionStartCondition': 'EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE', 'autoDisablePolicy': {'failureCount': 3}}, status='ENABLED', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE30303')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
async def create_image_pipeline(
    self,
    name: "capo_imagebuilder.types.resource_name.ResourceName",
    infrastructure_configuration_arn: "capo_imagebuilder.types.infrastructure_configuration_arn.InfrastructureConfigurationArn",
    client_token: "capo_imagebuilder.types.client_token.ClientToken",
    *,
    config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
    description: Optional[
        "capo_imagebuilder.types.non_empty_string.NonEmptyString"
    ] = None,
    image_recipe_arn: Optional[
        "capo_imagebuilder.types.image_recipe_arn.ImageRecipeArn"
    ] = None,
    container_recipe_arn: Optional[
        "capo_imagebuilder.types.container_recipe_arn.ContainerRecipeArn"
    ] = None,
    distribution_configuration_arn: Optional[
        "capo_imagebuilder.types.distribution_configuration_arn.DistributionConfigurationArn"
    ] = None,
    image_tests_configuration: Optional[
        "capo_imagebuilder.types.image_tests_configuration.ImageTestsConfiguration"
    ] = None,
    enhanced_image_metadata_enabled: Optional[
        "capo_imagebuilder.types.nullable_boolean.NullableBoolean"
    ] = None,
    schedule: Optional["capo_imagebuilder.types.schedule.Schedule"] = None,
    status: Optional[
        "capo_imagebuilder.types.pipeline_status.PipelineStatus"
    ] = None,
    tags: Optional["capo_imagebuilder.types.tag_map.TagMap"] = None,
    image_tags: Optional["capo_imagebuilder.types.tag_map.TagMap"] = None,
    image_scanning_configuration: Optional[
        "capo_imagebuilder.types.image_scanning_configuration.ImageScanningConfiguration"
    ] = None,
    workflows: Optional[
        "capo_imagebuilder.types.workflow_configuration_list.WorkflowConfigurationList"
    ] = None,
    execution_role: Optional[
        "capo_imagebuilder.types.role_name_or_arn.RoleNameOrArn"
    ] = None,
    logging_configuration: Optional[
        "capo_imagebuilder.types.pipeline_logging_configuration.PipelineLoggingConfiguration"
    ] = None,
    dry_run: Optional["capo_imagebuilder.types.boolean.Boolean"] = None,
) -> "capo_imagebuilder.types.create_image_pipeline_response.CreateImagePipelineResponse":
    """<p>Creates a new image pipeline. Use image pipelines to automate the creation and distribution of images. You must specify exactly one recipe for the pipeline, using either a <code>containerRecipeArn</code> or an <code>imageRecipeArn</code>.</p>

    Args:
        name: <p>The name of the image pipeline. Pipeline names must be unique to your account in each Amazon Web Services Region. Image Builder generates the pipeline ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name.</p>
        description: <p>The description of the image pipeline.</p>
        image_recipe_arn: <p>The Amazon Resource Name (ARN) of the image recipe that configures images created by this image pipeline. You must specify either this property or <code>containerRecipeArn</code>, but not both.</p>
        container_recipe_arn: <p>The Amazon Resource Name (ARN) of the container recipe that is used to configure images created by this container pipeline. You must specify either this property or <code>imageRecipeArn</code>, but not both.</p>
        infrastructure_configuration_arn: <p>The Amazon Resource Name (ARN) of the infrastructure configuration that builds images created by this image pipeline.</p>
        distribution_configuration_arn: <p>The Amazon Resource Name (ARN) of the distribution configuration that configures and distributes images created by this image pipeline.</p>
        image_tests_configuration: <p>Specifies the test settings that Image Builder applies to images that this pipeline creates. If you don't provide test settings, Image Builder stores a default configuration with image tests enabled.</p>
        enhanced_image_metadata_enabled: <p>Specifies whether to collect additional information about the image being created, including the operating system (OS) version and package list. Defaults to <code>true</code>.</p>
        schedule: <p>The schedule of the image pipeline. If you don't provide a schedule, the pipeline runs only when you call <a>StartImagePipelineExecution</a>.</p>
        status: <p>The status of the image pipeline. If you don't specify a status, it defaults to <code>ENABLED</code>. A disabled pipeline doesn't run on its schedule, but you can still start builds manually.</p>
        tags: <p>The tags of the image pipeline.</p>
        image_tags: <p>The tags that Image Builder applies to the Image Builder image resource that this pipeline's scheduled executions create. These tags don't apply to the output AMI. To tag output AMIs, use <code>amiTags</code> in the pipeline's distribution configuration.</p>
        client_token: <p>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 <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a> in the <i>Amazon EC2 API Reference</i>.</p>
        image_scanning_configuration: <p>Contains settings for vulnerability scans that Amazon Inspector runs against the test instance during image creation.</p>
        workflows: <p>The array of workflow configuration objects for builds that this pipeline starts. You must also specify <code>executionRole</code> when you provide workflows.</p>
        execution_role: <p>The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to perform workflow actions.</p>
        logging_configuration: <p>Specifies the logging configuration for the image pipeline. Use this to define custom CloudWatch Logs log groups for your pipeline execution logs and image build logs. The service manages log groups with names starting with <code>/aws/imagebuilder/</code> using the service-linked role. For custom log group names outside of this prefix, you must also provide an <code>executionRole</code>.</p>
        dry_run: <p>Validates the required permissions and request parameters without performing the operation. If validation succeeds, the operation returns a <code>DryRunOperationException</code> error response.</p>

    Raises:
        capo_imagebuilder.errors.call_rate_limit_exceeded_exception.CallRateLimitExceededException: <p>You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.</p>
        capo_imagebuilder.errors.client_exception.ClientException: <p>A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.</p>
        capo_imagebuilder.errors.dry_run_operation_exception.DryRunOperationException: <p>The dry run operation of the resource was successful, and no resources or mutations were actually performed due to the dry run flag in the request.</p>
        capo_imagebuilder.errors.forbidden_exception.ForbiddenException: <p>You are not authorized to perform the requested operation.</p>
        capo_imagebuilder.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.</p>
        capo_imagebuilder.errors.invalid_request_exception.InvalidRequestException: <p>The request is malformed or otherwise invalid. Verify the request and try again.</p>
        capo_imagebuilder.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource that you are trying to create already exists.</p>
        capo_imagebuilder.errors.resource_in_use_exception.ResourceInUseException: <p>The resource that you are trying to operate on is currently in use. Review the message details and retry later.</p>
        capo_imagebuilder.errors.service_exception.ServiceException: <p>An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.</p>
        capo_imagebuilder.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded the number of permitted resources or operations for this service. For service quotas, see <a href="https://docs.aws.amazon.com/general/latest/gr/imagebuilder.html#limits_imagebuilder">EC2 Image Builder endpoints and quotas</a>.</p>
        capo_imagebuilder.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unable to process your request at this time.</p>
        capo_imagebuilder.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create an image pipeline
        The following example creates a pipeline that builds a new image version every Sunday at 9:00 AM UTC, if the base image or components have updates.

        >>> await client.create_image_pipeline(name='my-example-pipeline', description='Builds a new version of my image every Sunday', image_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.0.0', infrastructure_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure', distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', schedule={'scheduleExpression': 'cron(0 9 ? * SUN *)', 'pipelineExecutionStartCondition': 'EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE'}, status='ENABLED', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE55555')
        Create an image pipeline with scanning, custom workflows, and an auto-disable policy
        The following example creates a pipeline that uses your custom build workflow and enables image scanning. The schedule evaluates its cron expression in the America/Los_Angeles time zone. The auto-disable policy disables the pipeline after 3 consecutive failed scheduled builds.

        >>> await client.create_image_pipeline(name='my-example-pipeline', description='Builds a scanned image with my custom build workflow on Sunday mornings when dependency updates are available', image_recipe_arn='arn:aws:imagebuilder:us-west-2:111122223333:image-recipe/my-example-recipe/1.1.0', infrastructure_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:infrastructure-configuration/my-example-infrastructure', distribution_configuration_arn='arn:aws:imagebuilder:us-west-2:111122223333:distribution-configuration/my-example-distribution', workflows=[{'workflowArn': 'arn:aws:imagebuilder:us-west-2:111122223333:workflow/build/my-example-workflow/1.0.0/1'}], execution_role='arn:aws:iam::111122223333:role/aws-service-role/imagebuilder.amazonaws.com/AWSServiceRoleForImageBuilder', image_scanning_configuration={'imageScanningEnabled': True}, schedule={'scheduleExpression': 'cron(0 9 ? * SUN *)', 'timezone': 'America/Los_Angeles', 'pipelineExecutionStartCondition': 'EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE', 'autoDisablePolicy': {'failureCount': 3}}, status='ENABLED', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE30303')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_imagebuilder.types.create_image_pipeline_request.CreateImagePipelineRequest]",
    ) -> AsyncOperationResponse[
        "capo_imagebuilder.types.create_image_pipeline_response.CreateImagePipelineResponse"
    ]:
        import capo_imagebuilder._operations.imagebuilder.create_image_pipeline

        (
            output,
            http_response,
        ) = await capo_imagebuilder._operations.imagebuilder.create_image_pipeline.async_create_image_pipeline(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateImagePipeline")
    )
    input_: capo_imagebuilder.types.create_image_pipeline_request.CreateImagePipelineRequest = {
        "name": name,
        "infrastructure_configuration_arn": infrastructure_configuration_arn,
        "client_token": client_token,
    }
    if description is not None:
        input_["description"] = description
    if image_recipe_arn is not None:
        input_["image_recipe_arn"] = image_recipe_arn
    if container_recipe_arn is not None:
        input_["container_recipe_arn"] = container_recipe_arn
    if distribution_configuration_arn is not None:
        input_["distribution_configuration_arn"] = distribution_configuration_arn
    if image_tests_configuration is not None:
        input_["image_tests_configuration"] = image_tests_configuration
    if enhanced_image_metadata_enabled is not None:
        input_["enhanced_image_metadata_enabled"] = enhanced_image_metadata_enabled
    if schedule is not None:
        input_["schedule"] = schedule
    if status is not None:
        input_["status"] = status
    if tags is not None:
        input_["tags"] = tags
    if image_tags is not None:
        input_["image_tags"] = image_tags
    if image_scanning_configuration is not None:
        input_["image_scanning_configuration"] = image_scanning_configuration
    if workflows is not None:
        input_["workflows"] = workflows
    if execution_role is not None:
        input_["execution_role"] = execution_role
    if logging_configuration is not None:
        input_["logging_configuration"] = logging_configuration
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output