create_image_pipeline
¶
create_image_pipeline(
name: ResourceName,
infrastructure_configuration_arn: InfrastructureConfigurationArn,
client_token: ClientToken,
*,
config_overrides: Optional[imagebuilderClientConfig] = 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
amiTagsin 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
executionRolewhen 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 anexecutionRole. -
dry_run(Optional[Boolean], default:None) –Validates the required permissions and request parameters without performing the operation. If validation succeeds, the operation returns a
DryRunOperationExceptionerror 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.
>>> 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.
>>> 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/imagebuilder.py
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | |