AmplifyGen3 / Client / create_environment

create_environment

AmplifyGen3.Client.create_environment(**kwargs)

Creates an environment for a Gen 3 app.

See also: AWS API Documentation

Request Syntax

response = client.create_environment(
    AppName='string',
    EnvironmentName='string',
    EnvironmentRoleArn='string',
    EnvironmentRolePermissionMode='SCOPED'|'FULL',
    SourceConfig={
        'GitSource': {
            'BranchMatchPatterns': [
                'string',
            ],
            'DeploymentTriggerEvents': [
                'PUSH'|'PULL_REQUEST'|'FORK_PULL_REQUEST',
            ]
        }
    },
    GradualRolloutConfig={
        'PresetConfig': {
            'Preset': 'ALL_AT_ONCE'|'CANARY_10_PERCENT_5_MINUTES'|'CANARY_10_PERCENT_15_MINUTES'|'CANARY_10_PERCENT_30_MINUTES'|'LINEAR_10_PERCENT_EVERY_1_MINUTE'|'LINEAR_10_PERCENT_EVERY_3_MINUTES'|'LINEAR_10_PERCENT_EVERY_10_MINUTES'
        }
    },
    Tags={
        'string': 'string'
    },
    Web={
        'EnvironmentAliasConfig': {
            'RoutingMode': 'AUTO_ROUTE_TO_LATEST'|'MANUAL'
        },
        'SkewProtectionConfig': {
            'Status': 'ENABLED'|'DISABLED',
            'CookieMaxAgeSeconds': 123
        }
    },
    NetworkConfig={
        'BuildNetworkConnectorArn': 'string',
        'ComputeNetworkConnectorArn': 'string'
    },
    Backend={
        'Auth': 'string',
        'Database': {
            'MaxBackendCapacityUnits': 123,
            'BackupRetentionDays': 123
        }
    }
)
Parameters:
  • AppName (string) –

    [REQUIRED]

    The name of the app.

  • EnvironmentName (string) –

    [REQUIRED]

    The name of the environment.

  • EnvironmentRoleArn (string) –

    [REQUIRED]

    The Amazon Resource Name (ARN) of the IAM role for the environment.

  • EnvironmentRolePermissionMode (string) – The permission mode for the environment’s IAM role.

  • SourceConfig (dict) –

    The source configuration for the environment.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: GitSource.

    • GitSource (dict) –

      The Git source information.

      • BranchMatchPatterns (list) – [REQUIRED]

        The branch name patterns that trigger a deployment.

        • (string) –

      • DeploymentTriggerEvents (list) –

        The Git events that trigger a deployment.

        • (string) –

  • GradualRolloutConfig (dict) –

    The gradual rollout settings for the environment.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: PresetConfig.

    • PresetConfig (dict) –

      The predefined gradual rollout schedule.

      • Preset (string) – [REQUIRED]

        The predefined gradual rollout schedule to use.

  • Tags (dict) –

    The tags to apply to the resource.

    • (string) –

      • (string) –

  • Web (dict) –

    The web hosting settings for the environment.

    • EnvironmentAliasConfig (dict) –

      The alias routing settings for the environment.

      • RoutingMode (string) –

        How the environment alias routes traffic to deployments.

    • SkewProtectionConfig (dict) –

      The version skew protection settings.

      • Status (string) –

        The status of the resource.

      • CookieMaxAgeSeconds (integer) –

        The maximum age, in seconds, of the version skew protection cookie.

  • NetworkConfig (dict) –

    The VPC network configuration for the environment.

    • BuildNetworkConnectorArn (string) –

      The Amazon Resource Name (ARN) of the network connector used for VPC access during builds.

    • ComputeNetworkConnectorArn (string) –

      The Amazon Resource Name (ARN) of the network connector used for VPC access at runtime.

  • Backend (dict) –

    The backend settings for the environment. You can specify this only when the app has a backend. If you omit this, the default authentication settings and the plan’s default database settings are used.

    • Auth (string) –

      The authentication settings for the environment’s backend, as a JSON document. A secret value must be a reference to a BACKEND-scoped environment variable, in the form ${env:NAME}. If you omit this, the default settings are used.

    • Database (dict) –

      The database settings for the environment. If you omit this, the plan’s defaults are used. A value above the limit of the account’s plan causes the next deployment to fail, not this request, because the plan can change between the two.

      • MaxBackendCapacityUnits (integer) –

        The maximum number of backend capacity units that the environment’s database can scale to.

      • BackupRetentionDays (integer) –

        The number of days to keep automated backups. This is also how far back the environment’s database can be restored.

Return type:

dict

Returns:

Response Syntax

{
    'EnvironmentArn': 'string'
}

Response Structure

  • (dict) –

    • EnvironmentArn (string) –

      The Amazon Resource Name (ARN) of the environment.

Exceptions

  • AmplifyGen3.Client.exceptions.ServiceQuotaExceededException

  • AmplifyGen3.Client.exceptions.ThrottlingException

  • AmplifyGen3.Client.exceptions.AccessDeniedException

  • AmplifyGen3.Client.exceptions.ResourceNotFoundException

  • AmplifyGen3.Client.exceptions.ValidationException

  • AmplifyGen3.Client.exceptions.ConflictException

  • AmplifyGen3.Client.exceptions.InternalServerException