update_environment

ElasticBeanstalk.Client.update_environment(**kwargs)

Updates the environment description, deploys a new application version, updates the configuration settings to an entirely new configuration template, or updates select configuration option values in the running environment.

Attempting to update both the release and configuration is not allowed and AWS Elastic Beanstalk returns an InvalidParameterCombination error.

When updating the configuration settings to a new template or individual settings, a draft configuration is created and DescribeConfigurationSettings for this environment returns two setting descriptions with different DeploymentStatus values.

See also: AWS API Documentation

Request Syntax

response = client.update_environment(
    ApplicationName='string',
    EnvironmentId='string',
    EnvironmentName='string',
    GroupName='string',
    Description='string',
    Tier={
        'Name': 'string',
        'Type': 'string',
        'Version': 'string'
    },
    VersionLabel='string',
    TemplateName='string',
    SolutionStackName='string',
    PlatformArn='string',
    OptionSettings=[
        {
            'ResourceName': 'string',
            'Namespace': 'string',
            'OptionName': 'string',
            'Value': 'string'
        },
    ],
    OptionsToRemove=[
        {
            'ResourceName': 'string',
            'Namespace': 'string',
            'OptionName': 'string'
        },
    ]
)
Parameters
  • ApplicationName (string) -- The name of the application with which the environment is associated.
  • EnvironmentId (string) --

    The ID of the environment to update.

    If no environment with this ID exists, AWS Elastic Beanstalk returns an InvalidParameterValue error.

    Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.

  • EnvironmentName (string) --

    The name of the environment to update. If no environment with this name exists, AWS Elastic Beanstalk returns an InvalidParameterValue error.

    Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, AWS Elastic Beanstalk returns MissingRequiredParameter error.

  • GroupName (string) -- The name of the group to which the target environment belongs. Specify a group name only if the environment's name is specified in an environment manifest and not with the environment name or environment ID parameters. See Environment Manifest (env.yaml) for details.
  • Description (string) -- If this parameter is specified, AWS Elastic Beanstalk updates the description of this environment.
  • Tier (dict) --

    This specifies the tier to use to update the environment.

    Condition: At this time, if you change the tier version, name, or type, AWS Elastic Beanstalk returns InvalidParameterValue error.

    • Name (string) --

      The name of this environment tier.

      Valid values:

      • For Web server tierWebServer
      • For Worker tierWorker
    • Type (string) --

      The type of this environment tier.

      Valid values:

      • For Web server tierStandard
      • For Worker tierSQS/HTTP
    • Version (string) --

      The version of this environment tier. When you don't set a value to it, Elastic Beanstalk uses the latest compatible worker tier version.

      Note

      This member is deprecated. Any specific version that you set may become out of date. We recommend leaving it unspecified.

  • VersionLabel (string) -- If this parameter is specified, AWS Elastic Beanstalk deploys the named application version to the environment. If no such application version is found, returns an InvalidParameterValue error.
  • TemplateName (string) -- If this parameter is specified, AWS Elastic Beanstalk deploys this configuration template to the environment. If no such configuration template is found, AWS Elastic Beanstalk returns an InvalidParameterValue error.
  • SolutionStackName (string) -- This specifies the platform version that the environment will run after the environment is updated.
  • PlatformArn (string) -- The ARN of the platform, if used.
  • OptionSettings (list) --

    If specified, AWS Elastic Beanstalk updates the configuration set associated with the running environment and sets the specified configuration options to the requested value.

    • (dict) --

      A specification identifying an individual configuration option along with its current value. For a list of possible namespaces and option values, see Option Values in the AWS Elastic Beanstalk Developer Guide .

      • ResourceName (string) --

        A unique resource name for the option setting. Use it for a time–based scaling configuration option.

      • Namespace (string) --

        A unique namespace that identifies the option's associated AWS resource.

      • OptionName (string) --

        The name of the configuration option.

      • Value (string) --

        The current value for the configuration option.

  • OptionsToRemove (list) --

    A list of custom user-defined configuration options to remove from the configuration set for this environment.

    • (dict) --

      A specification identifying an individual configuration option.

      • ResourceName (string) --

        A unique resource name for a time-based scaling configuration option.

      • Namespace (string) --

        A unique namespace identifying the option's associated AWS resource.

      • OptionName (string) --

        The name of the configuration option.

Return type

dict

Returns

Response Syntax

{
    'EnvironmentName': 'string',
    'EnvironmentId': 'string',
    'ApplicationName': 'string',
    'VersionLabel': 'string',
    'SolutionStackName': 'string',
    'PlatformArn': 'string',
    'TemplateName': 'string',
    'Description': 'string',
    'EndpointURL': 'string',
    'CNAME': 'string',
    'DateCreated': datetime(2015, 1, 1),
    'DateUpdated': datetime(2015, 1, 1),
    'Status': 'Aborting'|'Launching'|'Updating'|'LinkingFrom'|'LinkingTo'|'Ready'|'Terminating'|'Terminated',
    'AbortableOperationInProgress': True|False,
    'Health': 'Green'|'Yellow'|'Red'|'Grey',
    'HealthStatus': 'NoData'|'Unknown'|'Pending'|'Ok'|'Info'|'Warning'|'Degraded'|'Severe'|'Suspended',
    'Resources': {
        'LoadBalancer': {
            'LoadBalancerName': 'string',
            'Domain': 'string',
            'Listeners': [
                {
                    'Protocol': 'string',
                    'Port': 123
                },
            ]
        }
    },
    'Tier': {
        'Name': 'string',
        'Type': 'string',
        'Version': 'string'
    },
    'EnvironmentLinks': [
        {
            'LinkName': 'string',
            'EnvironmentName': 'string'
        },
    ],
    'EnvironmentArn': 'string',
    'OperationsRole': 'string'
}

Response Structure

  • (dict) --

    Describes the properties of an environment.

    • EnvironmentName (string) --

      The name of this environment.

    • EnvironmentId (string) --

      The ID of this environment.

    • ApplicationName (string) --

      The name of the application associated with this environment.

    • VersionLabel (string) --

      The application version deployed in this environment.

    • SolutionStackName (string) --

      The name of the SolutionStack deployed with this environment.

    • PlatformArn (string) --

      The ARN of the platform version.

    • TemplateName (string) --

      The name of the configuration template used to originally launch this environment.

    • Description (string) --

      Describes this environment.

    • EndpointURL (string) --

      For load-balanced, autoscaling environments, the URL to the LoadBalancer. For single-instance environments, the IP address of the instance.

    • CNAME (string) --

      The URL to the CNAME for this environment.

    • DateCreated (datetime) --

      The creation date for this environment.

    • DateUpdated (datetime) --

      The last modified date for this environment.

    • Status (string) --

      The current operational status of the environment:

      • Launching : Environment is in the process of initial deployment.
      • Updating : Environment is in the process of updating its configuration settings or application version.
      • Ready : Environment is available to have an action performed on it, such as update or terminate.
      • Terminating : Environment is in the shut-down process.
      • Terminated : Environment is not running.
    • AbortableOperationInProgress (boolean) --

      Indicates if there is an in-progress environment configuration update or application version deployment that you can cancel.

      true: There is an update in progress.

      false: There are no updates currently in progress.

    • Health (string) --

      Describes the health status of the environment. AWS Elastic Beanstalk indicates the failure levels for a running environment:

      • Red : Indicates the environment is not responsive. Occurs when three or more consecutive failures occur for an environment.
      • Yellow : Indicates that something is wrong. Occurs when two consecutive failures occur for an environment.
      • Green : Indicates the environment is healthy and fully functional.
      • Grey : Default health for a new environment. The environment is not fully launched and health checks have not started or health checks are suspended during an UpdateEnvironment or RestartEnvironment request.

      Default: Grey

    • HealthStatus (string) --

      Returns the health status of the application running in your environment. For more information, see Health Colors and Statuses.

    • Resources (dict) --

      The description of the AWS resources used by this environment.

      • LoadBalancer (dict) --

        Describes the LoadBalancer.

        • LoadBalancerName (string) --

          The name of the LoadBalancer.

        • Domain (string) --

          The domain name of the LoadBalancer.

        • Listeners (list) --

          A list of Listeners used by the LoadBalancer.

          • (dict) --

            Describes the properties of a Listener for the LoadBalancer.

            • Protocol (string) --

              The protocol that is used by the Listener.

            • Port (integer) --

              The port that is used by the Listener.

    • Tier (dict) --

      Describes the current tier of this environment.

      • Name (string) --

        The name of this environment tier.

        Valid values:

        • For Web server tierWebServer
        • For Worker tierWorker
      • Type (string) --

        The type of this environment tier.

        Valid values:

        • For Web server tierStandard
        • For Worker tierSQS/HTTP
      • Version (string) --

        The version of this environment tier. When you don't set a value to it, Elastic Beanstalk uses the latest compatible worker tier version.

        Note

        This member is deprecated. Any specific version that you set may become out of date. We recommend leaving it unspecified.

    • EnvironmentLinks (list) --

      A list of links to other environments in the same group.

      • (dict) --

        A link to another environment, defined in the environment's manifest. Links provide connection information in system properties that can be used to connect to another environment in the same group. See Environment Manifest (env.yaml) for details.

        • LinkName (string) --

          The name of the link.

        • EnvironmentName (string) --

          The name of the linked environment (the dependency).

    • EnvironmentArn (string) --

      The environment's Amazon Resource Name (ARN), which can be used in other API requests that require an ARN.

    • OperationsRole (string) --

      The Amazon Resource Name (ARN) of the environment's operations role. For more information, see Operations roles in the AWS Elastic Beanstalk Developer Guide .

Exceptions

  • ElasticBeanstalk.Client.exceptions.InsufficientPrivilegesException
  • ElasticBeanstalk.Client.exceptions.TooManyBucketsException

Examples

The following operation updates an environment named "my-env" to version "v2" of the application to which it belongs:

response = client.update_environment(
    EnvironmentName='my-env',
    VersionLabel='v2',
)

print(response)

Expected Output:

{
    'ApplicationName': 'my-app',
    'CNAME': 'my-env.elasticbeanstalk.com',
    'DateCreated': datetime(2015, 2, 3, 23, 4, 54, 1, 34, 0),
    'DateUpdated': datetime(2015, 2, 3, 23, 12, 29, 1, 34, 0),
    'EndpointURL': 'awseb-e-i-AWSEBLoa-1RDLX6TC9VUAO-0123456789.us-west-2.elb.amazonaws.com',
    'EnvironmentId': 'e-szqipays4h',
    'EnvironmentName': 'my-env',
    'Health': 'Grey',
    'SolutionStackName': '64bit Amazon Linux running Tomcat 7',
    'Status': 'Updating',
    'Tier': {
        'Name': 'WebServer',
        'Type': 'Standard',
        'Version': ' ',
    },
    'VersionLabel': 'v2',
    'ResponseMetadata': {
        '...': '...',
    },
}

The following operation configures several options in the aws:elb:loadbalancer namespace:

response = client.update_environment(
    EnvironmentName='my-env',
    OptionSettings=[
        {
            'Namespace': 'aws:elb:healthcheck',
            'OptionName': 'Interval',
            'Value': '15',
        },
        {
            'Namespace': 'aws:elb:healthcheck',
            'OptionName': 'Timeout',
            'Value': '8',
        },
        {
            'Namespace': 'aws:elb:healthcheck',
            'OptionName': 'HealthyThreshold',
            'Value': '2',
        },
        {
            'Namespace': 'aws:elb:healthcheck',
            'OptionName': 'UnhealthyThreshold',
            'Value': '3',
        },
    ],
)

print(response)

Expected Output:

{
    'AbortableOperationInProgress': True,
    'ApplicationName': 'my-app',
    'CNAME': 'my-env.elasticbeanstalk.com',
    'DateCreated': datetime(2015, 8, 7, 20, 48, 49, 4, 219, 0),
    'DateUpdated': datetime(2015, 8, 12, 18, 15, 23, 2, 224, 0),
    'EndpointURL': 'awseb-e-w-AWSEBLoa-14XB83101Q4L-104QXY80921.sa-east-1.elb.amazonaws.com',
    'EnvironmentId': 'e-wtp2rpqsej',
    'EnvironmentName': 'my-env',
    'Health': 'Grey',
    'SolutionStackName': '64bit Amazon Linux 2015.03 v2.0.0 running Tomcat 8 Java 8',
    'Status': 'Updating',
    'Tier': {
        'Name': 'WebServer',
        'Type': 'Standard',
        'Version': ' ',
    },
    'VersionLabel': '7f58-stage-150812_025409',
    'ResponseMetadata': {
        '...': '...',
    },
}