AppConfig / Client / create_environment

create_environment#

AppConfig.Client.create_environment(**kwargs)#

Creates an environment. For each application, you define one or more environments. An environment is a deployment group of AppConfig targets, such as applications in a Beta or Production environment. You can also define environments for application subcomponents such as the Web, Mobile and Back-end components for your application. You can configure Amazon CloudWatch alarms for each environment. The system monitors alarms during a configuration deployment. If an alarm is triggered, the system rolls back the configuration.

See also: AWS API Documentation

Request Syntax

response = client.create_environment(
    ApplicationId='string',
    Name='string',
    Description='string',
    Monitors=[
        {
            'AlarmArn': 'string',
            'AlarmRoleArn': 'string'
        },
    ],
    Tags={
        'string': 'string'
    }
)
Parameters:
  • ApplicationId (string) –

    [REQUIRED]

    The application ID.

  • Name (string) –

    [REQUIRED]

    A name for the environment.

  • Description (string) – A description of the environment.

  • Monitors (list) –

    Amazon CloudWatch alarms to monitor during the deployment process.

    • (dict) –

      Amazon CloudWatch alarms to monitor during the deployment process.

      • AlarmArn (string) – [REQUIRED]

        Amazon Resource Name (ARN) of the Amazon CloudWatch alarm.

      • AlarmRoleArn (string) –

        ARN of an Identity and Access Management (IAM) role for AppConfig to monitor AlarmArn.

  • Tags (dict) –

    Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'ApplicationId': 'string',
    'Id': 'string',
    'Name': 'string',
    'Description': 'string',
    'State': 'READY_FOR_DEPLOYMENT'|'DEPLOYING'|'ROLLING_BACK'|'ROLLED_BACK',
    'Monitors': [
        {
            'AlarmArn': 'string',
            'AlarmRoleArn': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • ApplicationId (string) –

      The application ID.

    • Id (string) –

      The environment ID.

    • Name (string) –

      The name of the environment.

    • Description (string) –

      The description of the environment.

    • State (string) –

      The state of the environment. An environment can be in one of the following states: READY_FOR_DEPLOYMENT, DEPLOYING, ROLLING_BACK, or ROLLED_BACK

    • Monitors (list) –

      Amazon CloudWatch alarms monitored during the deployment.

      • (dict) –

        Amazon CloudWatch alarms to monitor during the deployment process.

        • AlarmArn (string) –

          Amazon Resource Name (ARN) of the Amazon CloudWatch alarm.

        • AlarmRoleArn (string) –

          ARN of an Identity and Access Management (IAM) role for AppConfig to monitor AlarmArn.

Exceptions

  • AppConfig.Client.exceptions.InternalServerException

  • AppConfig.Client.exceptions.ResourceNotFoundException

  • AppConfig.Client.exceptions.BadRequestException

Examples

The following create-environment example creates an AWS AppConfig environment named Example-Environment using the application you created using create-application

response = client.create_environment(
    ApplicationId='339ohji',
    Name='Example-Environment',
)

print(response)

Expected Output:

{
    'ApplicationId': '339ohji',
    'Id': '54j1r29',
    'Name': 'Example-Environment',
    'State': 'READY_FOR_DEPLOYMENT',
    'ResponseMetadata': {
        '...': '...',
    },
}