create_workflow
async
¶
create_workflow(
name: ResourceName,
semantic_version: VersionNumber,
client_token: ClientToken,
type: WorkflowType,
*,
config_overrides: Optional[AsyncimagebuilderClientConfig] = None,
description: Optional[NonEmptyString] = None,
change_description: Optional[NonEmptyString] = None,
data: Optional[InlineWorkflowData] = None,
uri: Optional[Uri] = None,
kms_key_id: Optional[NonEmptyString] = None,
tags: Optional[TagMap] = None,
dry_run: Optional[Boolean] = None,
) -> CreateWorkflowResponse
Creates a new workflow or a new version of an existing workflow. If a workflow with the same name and semantic version already exists, and your request changes its configuration, Image Builder creates a new build version. If the configuration is identical to the latest build version, the request fails because that workflow configuration already exists.
Parameters:
-
name(ResourceName) –The name of the workflow to create. Image Builder generates the workflow ARN from a normalized form of the name, so names that differ only in case, spaces, or underscores count as the same name. If a workflow with the same name and semantic version already exists in your account in the same Amazon Web Services Region, the request creates a new build version for it. If the content is also identical to the latest build version, the request fails because the workflow already exists.
-
semantic_version(VersionNumber) –The semantic version of this workflow resource. The semantic version syntax adheres to the following rules.
The semantic version has four nodes:
. . / . You can assign values for the first three, and can filter on all of them. Assignment: For the first three nodes, you can assign any positive integer value, including zero. The upper limit is 2^30-1, or 1073741823, for each node. Image Builder automatically assigns the build number to the fourth node.
Patterns: You can use any numeric pattern that adheres to the assignment requirements for the nodes that you can assign. For example, you might choose a software version pattern, such as 1.0.0, or a date, such as 2021.01.01.
-
description(Optional[NonEmptyString], default:None) –Describes the workflow.
-
change_description(Optional[NonEmptyString], default:None) –Describes what change has been made in this version of the workflow, or what makes this version different from other versions of the workflow.
-
data(Optional[InlineWorkflowData], default:None) –The UTF-8 encoded YAML document content for the workflow, up to 16,000 characters. For larger documents, store the document in Amazon S3 and specify the
uriproperty instead. You must specify exactly one of thedataoruriproperties. -
uri(Optional[Uri], default:None) –The
uriof a YAML workflow document file stored in Amazon S3. This must be an S3 URL (s3://bucket/key), and you must have permission to access the S3 bucket it points to. A workflow document that you provide from Amazon S3 can be up to your service quota for workflow size.Alternatively, you can specify the YAML document inline, using the workflow
dataproperty. You must specify exactly one of thedataoruriproperties. -
kms_key_id(Optional[NonEmptyString], default:None) –The Amazon Resource Name (ARN) that uniquely identifies the KMS key used to encrypt this workflow resource. This can be either the Key ARN or the Alias ARN. For more information, see Key identifiers (KeyId) in the Key Management Service Developer Guide. If you don't specify a key, Image Builder encrypts the workflow document with a KMS key that Image Builder owns.
-
tags(Optional[TagMap], default:None) –Tags that apply to the workflow resource.
-
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.
-
type(WorkflowType) –The image creation stage that this workflow applies to. Image Builder validates the workflow document steps against the stage you specify.
-
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.
-
InvalidParameterCombinationException–You have specified a combination of parameters that isn't valid. For example, two mutually exclusive parameters, or a parameter without its required companion parameter. Review the error message for details.
-
InvalidRequestException–The request is malformed or otherwise invalid. Verify the request and try again.
-
InvalidVersionNumberException–Your version number is out of bounds or does not follow the required syntax.
-
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 a build workflow from an inline document The following example creates a build workflow from a YAML workflow document provided inline in the request.
>>> await client.create_workflow(name='my-example-workflow', semantic_version='1.0.0', description='Workflow to build an AMI', type='BUILD', data='name: my-example-workflow\ndescription: Workflow to build an AMI\nschemaVersion: 1.0\nsteps:\n - name: LaunchBuildInstance\n action: LaunchInstance\n onFailure: Abort\n inputs:\n waitFor: ssmAgent\n - name: ApplyBuildComponents\n action: ExecuteComponents\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: CreateOutputAMI\n action: CreateImage\n onFailure: Abort\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n - name: TerminateBuildInstance\n action: TerminateInstance\n onFailure: Continue\n inputs:\n instanceId.$: $.stepOutputs.LaunchBuildInstance.instanceId\n', client_token='a1b2c3d4-5678-90ab-cdef-EXAMPLE54321')
Source code in docs_src/capo_imagebuilder/_services/async_imagebuilder.py
1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | |