Skip to content

create_application_version async

create_application_version(
    application_name: ApplicationName,
    version_label: VersionLabel,
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    description: Optional[Description] = None,
    source_build_information: Optional[SourceBuildInformation] = None,
    source_bundle: Optional[S3Location] = None,
    build_configuration: Optional[BuildConfiguration] = None,
    auto_create_application: Optional[AutoCreateApplication] = None,
    process: Optional[ApplicationVersionProccess] = None,
    tags: Optional[Tags] = None,
    image_configuration: Optional[ImageConfiguration] = None,
) -> ApplicationVersionDescriptionMessage

Creates an application version for the specified application. You can create an application version from a source bundle in Amazon S3, a commit in CodeCommit, or the output of an CodeBuild build as follows:

Specify a commit in an CodeCommit repository with SourceBuildInformation.

Specify a build in an CodeBuild with SourceBuildInformation and BuildConfiguration.

Specify a source bundle in Amazon S3 with SourceBundle

Omit both SourceBuildInformation and SourceBundle to use the default sample application.

After you create an application version with a specified Amazon S3 bucket and key location, you can't change that Amazon S3 location. If you change the Amazon S3 location, you receive an exception when you attempt to launch an environment from the application version.

Parameters:

  • application_name (ApplicationName) –

    The name of the application. If no application is found with this name, and AutoCreateApplication is false, returns an InvalidParameterValue error.

  • version_label (VersionLabel) –

    A label identifying this version.

    Constraint: Must be unique per application. If an application version already exists with this label for the specified application, Elastic Beanstalk returns an InvalidParameterValue error.

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

    A description of this application version.

  • source_build_information (Optional[SourceBuildInformation], default: None ) –

    Specify a commit in an CodeCommit Git repository to use as the source code for the application version.

  • source_bundle (Optional[S3Location], default: None ) –

    The Amazon S3 bucket and key that identify the location of the source bundle for this version.

    The Amazon S3 bucket must be in the same region as the environment.

    Unless you're specifying a source bundle in the bucket that Elastic Beanstalk manages in your account, you must assign a custom policy to your user, and grant Allow permission to the s3:Get* actions on your S3 object resource, for example, arn:aws:s3:::your-bucket/your-source-bundle-object.

    Specify a source bundle in Amazon S3 or a commit in an CodeCommit repository (with SourceBuildInformation), but not both. If neither SourceBundle nor SourceBuildInformation are provided, Elastic Beanstalk uses a sample application.

  • build_configuration (Optional[BuildConfiguration], default: None ) –

    Settings for an CodeBuild build.

    Don't specify BuildConfiguration together with ImageConfiguration, which configures a container image build instead.

  • auto_create_application (Optional[AutoCreateApplication], default: None ) –

    Set to true to create an application with the specified name if it doesn't already exist.

  • process (Optional[ApplicationVersionProccess], default: None ) –

    Pre-processes and validates the environment manifest (env.yaml) and configuration files (*.config files in the .ebextensions folder) in the source bundle. Validating configuration files can identify issues prior to deploying the application version to an environment.

    You must turn processing on for application versions that you create using CodeBuild or CodeCommit. For application versions built from a source bundle in Amazon S3, processing is optional.

    The Process option validates Elastic Beanstalk configuration files. It doesn't validate your application's configuration files, like proxy server or Docker configuration.

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

    Specifies the tags applied to the application version.

    Elastic Beanstalk applies these tags only to the application version. Environments that use the application version don't inherit the tags.

  • image_configuration (Optional[ImageConfiguration], default: None ) –

    The source of the container image for this application version. You can specify an image that you built and pushed to a container registry yourself, or settings for Elastic Beanstalk to build one from your source bundle. Specify exactly one of the Source and Build members.

    Don't specify ImageConfiguration together with BuildConfiguration, which configures an CodeBuild build instead.

Raises:

Examples:

To create a new application The following operation creates a new version (v1) of an application named my-app:

>>> await client.create_application_version(application_name='my-app', version_label='v1', description='my-app-v1', source_bundle={'S3Bucket': 'my-bucket', 'S3Key': 'sample.war'}, auto_create_application=True, process=True)
Source code in docs_src/capo_elastic_beanstalk/_services/async_elastic_beanstalk.py
async def create_application_version(
    self,
    application_name: "capo_elastic_beanstalk.types.application_name.ApplicationName",
    version_label: "capo_elastic_beanstalk.types.version_label.VersionLabel",
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    description: Optional[
        "capo_elastic_beanstalk.types.description.Description"
    ] = None,
    source_build_information: Optional[
        "capo_elastic_beanstalk.types.source_build_information.SourceBuildInformation"
    ] = None,
    source_bundle: Optional[
        "capo_elastic_beanstalk.types.s3_location.S3Location"
    ] = None,
    build_configuration: Optional[
        "capo_elastic_beanstalk.types.build_configuration.BuildConfiguration"
    ] = None,
    auto_create_application: Optional[
        "capo_elastic_beanstalk.types.auto_create_application.AutoCreateApplication"
    ] = None,
    process: Optional[
        "capo_elastic_beanstalk.types.application_version_proccess.ApplicationVersionProccess"
    ] = None,
    tags: Optional["capo_elastic_beanstalk.types.tags.Tags"] = None,
    image_configuration: Optional[
        "capo_elastic_beanstalk.types.image_configuration.ImageConfiguration"
    ] = None,
) -> "capo_elastic_beanstalk.types.application_version_description_message.ApplicationVersionDescriptionMessage":
    """<p>Creates an application version for the specified application. You can create an application version from a source bundle in Amazon S3, a commit in CodeCommit, or the output of an CodeBuild build as follows:</p> <p>Specify a commit in an CodeCommit repository with <code>SourceBuildInformation</code>.</p> <p>Specify a build in an CodeBuild with <code>SourceBuildInformation</code> and <code>BuildConfiguration</code>.</p> <p>Specify a source bundle in Amazon S3 with <code>SourceBundle</code> </p> <p>Omit both <code>SourceBuildInformation</code> and <code>SourceBundle</code> to use the default sample application.</p> <note> <p>After you create an application version with a specified Amazon S3 bucket and key location, you can't change that Amazon S3 location. If you change the Amazon S3 location, you receive an exception when you attempt to launch an environment from the application version.</p> </note>

    Args:
        application_name: <p> The name of the application. If no application is found with this name, and <code>AutoCreateApplication</code> is <code>false</code>, returns an <code>InvalidParameterValue</code> error. </p>
        version_label: <p>A label identifying this version.</p> <p>Constraint: Must be unique per application. If an application version already exists with this label for the specified application, Elastic Beanstalk returns an <code>InvalidParameterValue</code> error. </p>
        description: <p>A description of this application version.</p>
        source_build_information: <p>Specify a commit in an CodeCommit Git repository to use as the source code for the application version.</p>
        source_bundle: <p>The Amazon S3 bucket and key that identify the location of the source bundle for this version.</p> <note> <p>The Amazon S3 bucket must be in the same region as the environment.</p> <p>Unless you're specifying a source bundle in the bucket that Elastic Beanstalk manages in your account, you must assign a custom policy to your user, and grant <code>Allow</code> permission to the <code>s3:Get*</code> actions on your S3 object resource, for example, <code>arn:aws:s3:::your-bucket/your-source-bundle-object</code>.</p> </note> <p>Specify a source bundle in Amazon S3 or a commit in an CodeCommit repository (with <code>SourceBuildInformation</code>), but not both. If neither <code>SourceBundle</code> nor <code>SourceBuildInformation</code> are provided, Elastic Beanstalk uses a sample application.</p>
        build_configuration: <p>Settings for an CodeBuild build.</p> <p>Don't specify <code>BuildConfiguration</code> together with <code>ImageConfiguration</code>, which configures a container image build instead.</p>
        auto_create_application: <p>Set to <code>true</code> to create an application with the specified name if it doesn't already exist.</p>
        process: <p>Pre-processes and validates the environment manifest (<code>env.yaml</code>) and configuration files (<code>*.config</code> files in the <code>.ebextensions</code> folder) in the source bundle. Validating configuration files can identify issues prior to deploying the application version to an environment.</p> <p>You must turn processing on for application versions that you create using CodeBuild or CodeCommit. For application versions built from a source bundle in Amazon S3, processing is optional.</p> <note> <p>The <code>Process</code> option validates Elastic Beanstalk configuration files. It doesn't validate your application's configuration files, like proxy server or Docker configuration.</p> </note>
        tags: <p>Specifies the tags applied to the application version.</p> <p>Elastic Beanstalk applies these tags only to the application version. Environments that use the application version don't inherit the tags.</p>
        image_configuration: <p>The source of the container image for this application version. You can specify an image that you built and pushed to a container registry yourself, or settings for Elastic Beanstalk to build one from your source bundle. Specify exactly one of the <code>Source</code> and <code>Build</code> members.</p> <p>Don't specify <code>ImageConfiguration</code> together with <code>BuildConfiguration</code>, which configures an CodeBuild build instead.</p>

    Raises:
        capo_elastic_beanstalk.errors.code_build_not_in_service_region_exception.CodeBuildNotInServiceRegionException: <p>CodeBuild is not available in the specified region.</p>
        capo_elastic_beanstalk.errors.insufficient_privileges_exception.InsufficientPrivilegesException: <p>The specified account does not have sufficient privileges for one or more Amazon Web Services services.</p>
        capo_elastic_beanstalk.errors.s3_location_not_in_service_region_exception.S3LocationNotInServiceRegionException: <p>The specified S3 bucket does not belong to the S3 region in which the service is running. The following regions are supported:</p> <ul> <li> <p>IAD/us-east-1</p> </li> <li> <p>PDX/us-west-2</p> </li> <li> <p>DUB/eu-west-1</p> </li> </ul>
        capo_elastic_beanstalk.errors.too_many_applications_exception.TooManyApplicationsException: <p>The specified account has reached its limit of applications.</p>
        capo_elastic_beanstalk.errors.too_many_application_versions_exception.TooManyApplicationVersionsException: <p>The specified account has reached its limit of application versions.</p>
        capo_elastic_beanstalk.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a new application
        The following operation creates a new version (v1) of an application named my-app:

        >>> await client.create_application_version(application_name='my-app', version_label='v1', description='my-app-v1', source_bundle={'S3Bucket': 'my-bucket', 'S3Key': 'sample.war'}, auto_create_application=True, process=True)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elastic_beanstalk.types.create_application_version_message.CreateApplicationVersionMessage]",
    ) -> AsyncOperationResponse[
        "capo_elastic_beanstalk.types.application_version_description_message.ApplicationVersionDescriptionMessage"
    ]:
        import capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.create_application_version

        (
            output,
            http_response,
        ) = await capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.create_application_version.async_create_application_version(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateApplicationVersion")
    )
    input_: capo_elastic_beanstalk.types.create_application_version_message.CreateApplicationVersionMessage = {
        "application_name": application_name,
        "version_label": version_label,
    }
    if description is not None:
        input_["description"] = description
    if source_build_information is not None:
        input_["source_build_information"] = source_build_information
    if source_bundle is not None:
        input_["source_bundle"] = source_bundle
    if build_configuration is not None:
        input_["build_configuration"] = build_configuration
    if auto_create_application is not None:
        input_["auto_create_application"] = auto_create_application
    if process is not None:
        input_["process"] = process
    if tags is not None:
        input_["tags"] = tags
    if image_configuration is not None:
        input_["image_configuration"] = image_configuration

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