

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::ElasticBeanstalk::Environment
<a name="aws-resource-elasticbeanstalk-environment"></a>

The AWS::ElasticBeanstalk::Environment resource is an AWS Elastic Beanstalk resource type that specifies an Elastic Beanstalk environment.

## Syntax
<a name="aws-resource-elasticbeanstalk-environment-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-elasticbeanstalk-environment-syntax.json"></a>

```
{
  "Type" : "AWS::ElasticBeanstalk::Environment",
  "Properties" : {
      "[ApplicationName](#cfn-elasticbeanstalk-environment-applicationname)" : String,
      "[CNAMEPrefix](#cfn-elasticbeanstalk-environment-cnameprefix)" : String,
      "[Description](#cfn-elasticbeanstalk-environment-description)" : String,
      "[EnvironmentName](#cfn-elasticbeanstalk-environment-environmentname)" : String,
      "[OperationsRole](#cfn-elasticbeanstalk-environment-operationsrole)" : String,
      "[OptionSettings](#cfn-elasticbeanstalk-environment-optionsettings)" : [ OptionSetting, ... ],
      "[PlatformArn](#cfn-elasticbeanstalk-environment-platformarn)" : String,
      "[SolutionStackName](#cfn-elasticbeanstalk-environment-solutionstackname)" : String,
      "[Tags](#cfn-elasticbeanstalk-environment-tags)" : [ Tag, ... ],
      "[TemplateName](#cfn-elasticbeanstalk-environment-templatename)" : String,
      "[Tier](#cfn-elasticbeanstalk-environment-tier)" : Tier,
      "[VersionLabel](#cfn-elasticbeanstalk-environment-versionlabel)" : String
    }
}
```

### YAML
<a name="aws-resource-elasticbeanstalk-environment-syntax.yaml"></a>

```
Type: AWS::ElasticBeanstalk::Environment
Properties:
  [ApplicationName](#cfn-elasticbeanstalk-environment-applicationname): String
  [CNAMEPrefix](#cfn-elasticbeanstalk-environment-cnameprefix): String
  [Description](#cfn-elasticbeanstalk-environment-description): String
  [EnvironmentName](#cfn-elasticbeanstalk-environment-environmentname): String
  [OperationsRole](#cfn-elasticbeanstalk-environment-operationsrole): String
  [OptionSettings](#cfn-elasticbeanstalk-environment-optionsettings): 
    - OptionSetting
  [PlatformArn](#cfn-elasticbeanstalk-environment-platformarn): String
  [SolutionStackName](#cfn-elasticbeanstalk-environment-solutionstackname): String
  [Tags](#cfn-elasticbeanstalk-environment-tags): 
    - Tag
  [TemplateName](#cfn-elasticbeanstalk-environment-templatename): String
  [Tier](#cfn-elasticbeanstalk-environment-tier): 
    Tier
  [VersionLabel](#cfn-elasticbeanstalk-environment-versionlabel): String
```

## Properties
<a name="aws-resource-elasticbeanstalk-environment-properties"></a>

`ApplicationName`  <a name="cfn-elasticbeanstalk-environment-applicationname"></a>
The name of the application that is associated with this environment.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `100`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`CNAMEPrefix`  <a name="cfn-elasticbeanstalk-environment-cnameprefix"></a>
If specified, the environment attempts to use this value as the prefix for the CNAME in your Elastic Beanstalk environment URL. If not specified, the CNAME is generated automatically by appending a random alphanumeric string to the environment name.  
*Required*: No  
*Type*: String  
*Minimum*: `4`  
*Maximum*: `63`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Description`  <a name="cfn-elasticbeanstalk-environment-description"></a>
Your description for this environment.  
*Required*: No  
*Type*: String  
*Maximum*: `200`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`EnvironmentName`  <a name="cfn-elasticbeanstalk-environment-environmentname"></a>
A unique name for the environment.  
Constraint: Must be from 4 to 40 characters in length. The name can contain only letters, numbers, and hyphens. It can't start or end with a hyphen. This name must be unique within a region in your account.  
If you don't specify the `CNAMEPrefix` parameter, the environment name becomes part of the CNAME, and therefore part of the visible URL for your application.  
If you don't specify an environment name, AWS CloudFormation generates a unique physical ID and uses that ID for the environment name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).  
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
*Required*: No  
*Type*: String  
*Minimum*: `4`  
*Maximum*: `40`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`OperationsRole`  <a name="cfn-elasticbeanstalk-environment-operationsrole"></a>
The operations role feature of AWS Elastic Beanstalk is in beta release and is subject to change.
The Amazon Resource Name (ARN) of an existing IAM role to be used as the environment's operations role. If specified, Elastic Beanstalk uses the operations role for permissions to downstream services during this call and during subsequent calls acting on this environment. To specify an operations role, you must have the `iam:PassRole` permission for the role.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`OptionSettings`  <a name="cfn-elasticbeanstalk-environment-optionsettings"></a>
Key-value pairs defining configuration options for this environment, such as the instance type. These options override the values that are defined in the solution stack or the [configuration template](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-beanstalk-configurationtemplate.html). If you remove any options during a stack update, the removed options retain their current values.  
*Required*: No  
*Type*: Array of [OptionSetting](aws-properties-elasticbeanstalk-environment-optionsetting.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PlatformArn`  <a name="cfn-elasticbeanstalk-environment-platformarn"></a>
The Amazon Resource Name (ARN) of the custom platform to use with the environment. For more information, see [Custom Platforms](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/custom-platforms.html) in the *AWS Elastic Beanstalk Developer Guide*.  
If you specify `PlatformArn`, don't specify `SolutionStackName`.
*Required*: No  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SolutionStackName`  <a name="cfn-elasticbeanstalk-environment-solutionstackname"></a>
The name of an Elastic Beanstalk solution stack (platform version) to use with the environment. If specified, Elastic Beanstalk sets the configuration values to the default values associated with the specified solution stack. For a list of current solution stacks, see [Elastic Beanstalk Supported Platforms](https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html) in the *AWS Elastic Beanstalk Platforms* guide.  
If you specify `SolutionStackName`, don't specify `PlatformArn` or `TemplateName`.
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Tags`  <a name="cfn-elasticbeanstalk-environment-tags"></a>
Specifies the tags applied to resources in the environment.  
*Required*: No  
*Type*: Array of [Tag](aws-properties-elasticbeanstalk-environment-tag.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TemplateName`  <a name="cfn-elasticbeanstalk-environment-templatename"></a>
The name of the Elastic Beanstalk configuration template to use with the environment.  
If you specify `TemplateName`, then don't specify `SolutionStackName`.
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `100`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tier`  <a name="cfn-elasticbeanstalk-environment-tier"></a>
Specifies the tier to use in creating this environment. The environment tier that you choose determines whether Elastic Beanstalk provisions resources to support a web application that handles HTTP(S) requests or a web application that handles background-processing tasks.  
*Required*: No  
*Type*: [Tier](aws-properties-elasticbeanstalk-environment-tier.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`VersionLabel`  <a name="cfn-elasticbeanstalk-environment-versionlabel"></a>
The name of the application version to deploy.  
Default: If not specified, Elastic Beanstalk attempts to deploy the sample application.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `100`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-elasticbeanstalk-environment-return-values"></a>

### Ref
<a name="aws-resource-elasticbeanstalk-environment-return-values-ref"></a>

When the logical ID of this resource is provided to the `Ref` intrinsic function, `Ref` returns the resource name.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-elasticbeanstalk-environment-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-elasticbeanstalk-environment-return-values-fn--getatt-fn--getatt"></a>

`EndpointURL`  <a name="EndpointURL-fn::getatt"></a>
For load-balanced, autoscaling environments, the URL to the load balancer. For single-instance environments, the IP address of the instance.  
Example load balancer URL:  
 `awseb-myst-myen-132MQC4KRLAMD-1371280482.us-east-2.elb.amazonaws.com`   
Example instance IP address:  
 `192.0.2.0` 

## Examples
<a name="aws-resource-elasticbeanstalk-environment--examples"></a>

**Topics**
+ [Simple Environment](#aws-resource-elasticbeanstalk-environment--examples--Simple_Environment)
+ [Environment with Embedded Option Settings](#aws-resource-elasticbeanstalk-environment--examples--Environment_with_Embedded_Option_Settings)
+ [Custom or Supported Platform](#aws-resource-elasticbeanstalk-environment--examples--Custom_or_Supported_Platform)

### Simple Environment
<a name="aws-resource-elasticbeanstalk-environment--examples--Simple_Environment"></a>

#### JSON
<a name="aws-resource-elasticbeanstalk-environment--examples--Simple_Environment--json"></a>

```
{
   "Type" : "AWS::ElasticBeanstalk::Environment",
   "Properties" : {
      "ApplicationName" : { "Ref" : "sampleApplication" },
      "Description" :  "AWS Elastic Beanstalk Environment running PHP Sample Application",
      "EnvironmentName" :  "SamplePHPEnvironment",
      "TemplateName" : "DefaultConfiguration",
      "VersionLabel" : "Initial Version"
   }
}
```

#### YAML
<a name="aws-resource-elasticbeanstalk-environment--examples--Simple_Environment--yaml"></a>

```
Type: AWS::ElasticBeanstalk::Environment
Properties: 
  ApplicationName: 
    Ref: sampleApplication
    Description: "AWS Elastic Beanstalk Environment running PHP Sample Application"
  EnvironmentName: SamplePHPEnvironment
  TemplateName: DefaultConfiguration
  VersionLabel: "Initial Version"
```

### Environment with Embedded Option Settings
<a name="aws-resource-elasticbeanstalk-environment--examples--Environment_with_Embedded_Option_Settings"></a>

#### JSON
<a name="aws-resource-elasticbeanstalk-environment--examples--Environment_with_Embedded_Option_Settings--json"></a>

```
{
   "Type" : "AWS::ElasticBeanstalk::Environment",
   "Properties" : {
      "ApplicationName" : { "Ref" : "sampleApplication" },
      "Description" :  "AWS Elastic Beanstalk Environment running Python Sample Application",
      "EnvironmentName" :  "SamplePythonEnvironment",
      "SolutionStackName" : "64bit Amazon Linux 2017.03 v2.5.0 running Python 2.7",
      "OptionSettings" : [ {
         "Namespace" : "aws:autoscaling:launchconfiguration",
         "OptionName" : "EC2KeyName",
         "Value" : { "Ref" : "KeyName" }
      } ],
      "VersionLabel" : "Initial Version"
   }
}
```

#### YAML
<a name="aws-resource-elasticbeanstalk-environment--examples--Environment_with_Embedded_Option_Settings--yaml"></a>

```
Type: AWS::ElasticBeanstalk::Environment
Properties: 
  ApplicationName: 
    Ref: sampleApplication
    Description: "AWS Elastic Beanstalk Environment running Python Sample Application"
  EnvironmentName: SamplePythonEnvironment
  SolutionStackName: "64bit Amazon Linux 2017.03 v2.5.0 running Python 2.7"
  OptionSettings: 
    - 
      Namespace: "aws:autoscaling:launchconfiguration"
      OptionName: EC2KeyName
      Value: 
        Ref: KeyName
  VersionLabel: "Initial Version"
```

### Custom or Supported Platform
<a name="aws-resource-elasticbeanstalk-environment--examples--Custom_or_Supported_Platform"></a>

The following example contains parameters that enable specifying `PlatformArn` for a custom platform or `SolutionStackName` for a supported platform when creating the stack.

#### JSON
<a name="aws-resource-elasticbeanstalk-environment--examples--Custom_or_Supported_Platform--json"></a>

```
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Elasticbeanstalk test template",
  "Parameters": {
    "BeanstalkService": {
      "Type": "String"
    },
    "Ec2Service": {
      "Type": "String"
    },
    "Partition":{
      "Type": "String"
    },
    "SolutionStackName": {
      "Type": "String"
    },
    "PlatformArn": {
      "Type": "String"
    }
  },
  "Resources": {
    "Application": {
      "Type": "AWS::ElasticBeanstalk::Application",
      "Properties": {
        "ApplicationName": "SampleBeanstalkApp",
        "Description": "AWS Elastic Beanstalk Python Sample Application"
      }
    },
    "AppVersion": {
      "Type": "AWS::ElasticBeanstalk::ApplicationVersion",
      "Properties": {
        "ApplicationName": {"Ref" : "Application"},
        "Description": "Version 1.0",
        "SourceBundle": {
          "S3Bucket": {
            "Fn::Join": ["-", [ "elasticbeanstalk-samples", { "Ref" : "AWS::Region" } ] ] },
          "S3Key": "python-sample-20150402.zip"
        }
      }
    },
    "Environment": {
      "Type": "AWS::ElasticBeanstalk::Environment",
      "Properties": {
        "ApplicationName": {"Ref": "Application"},
        "Description": "AWS Elastic Beanstalk Environment running Python Sample Application",
        "PlatformArn": { "Ref" : "PlatformArn"},
        "SolutionStackName": {
          "Ref": "SolutionStackName"
        },
        "VersionLabel": {"Ref": "AppVersion"},
        "OptionSettings": [
          {
            "Namespace": "aws:autoscaling:launchconfiguration",
            "OptionName": "IamInstanceProfile",
            "Value": {
              "Ref": "InstanceProfile"
            }
          },
          {
            "Namespace": "aws:elasticbeanstalk:environment",
            "OptionName": "ServiceRole",
            "Value": {
              "Ref": "ServiceRole"
            }
          }
        ]
      }
    },
    "ServiceRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17"		 	 	 ,
          "Statement": [
            {
              "Sid": "",
              "Effect": "Allow",
              "Principal": {
                "Service": {"Ref": "BeanstalkService"}
              },
              "Action": "sts:AssumeRole",
              "Condition": {
                "StringEquals": {
                  "sts:ExternalId": "elasticbeanstalk"
                }
              }
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": "root",
            "PolicyDocument": {
              "Version": "2012-10-17"		 	 	 ,
              "Statement": [
                {
                  "Effect": "Allow",
                  "Action": [
                    "elasticloadbalancing:DescribeInstanceHealth",
                    "ec2:DescribeInstances",
                    "ec2:DescribeInstanceStatus",
                    "ec2:GetConsoleOutput",
                    "ec2:AssociateAddress",
                    "ec2:DescribeAddresses",
                    "ec2:DescribeSecurityGroups",
                    "sqs:GetQueueAttributes",
                    "sqs:GetQueueUrl",
                    "autoscaling:DescribeAutoScalingGroups",
                    "autoscaling:DescribeAutoScalingInstances",
                    "autoscaling:DescribeScalingActivities",
                    "autoscaling:DescribeNotificationConfigurations"
                  ],
                  "Resource": [
                    "*"
                  ]
                }
              ]
            }
          }
        ],
        "Path": "/"
      }
    },
    "InstanceProfile": {
      "Type": "AWS::IAM::InstanceProfile",
      "Properties": {
        "Path": "/",
        "Roles": [
          {
            "Ref": "InstanceProfileRole"
          }
        ]
      }
    },
    "InstanceProfileRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17"		 	 	 ,
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  {"Ref": "Ec2Service"}
                ]
              },
              "Action": [
                "sts:AssumeRole"
              ]
            }
          ]
        },
        "Policies": [
          {
            "PolicyName": "root",
            "PolicyDocument": {
              "Version": "2012-10-17"		 	 	 ,
              "Statement": [
                {
                  "Sid": "BucketAccess",
                  "Action": [
                    "s3:Get*",
                    "s3:List*",
                    "s3:PutObject"
                  ],
                  "Effect": "Allow",
                  "Resource": [
                    {
                      "Fn::Join": [
                        "",
                        [
                          "arn:",
                          {
                            "Ref": "Partition"
                          },
                          ":s3:::elasticbeanstalk-*-",
                          {
                            "Ref": "AWS::AccountId"
                          }
                        ]
                      ]
                    },
                    {
                      "Fn::Join": [
                        "",
                        [
                          "arn:",
                          {
                            "Ref": "Partition"
                          },
                          ":s3:::elasticbeanstalk-*-",
                          {
                            "Ref": "AWS::AccountId"
                          },
                          "/*"
                        ]
                      ]
                    },
                    {
                      "Fn::Join": [
                        "",
                        [
                          "arn:",
                          {
                            "Ref": "Partition"
                          },
                          ":s3:::elasticbeanstalk-*-",
                          {
                            "Ref": "AWS::AccountId"
                          },
                          "-*"
                        ]
                      ]
                    },
                    {
                      "Fn::Join": [
                        "",
                        [
                          "arn:",
                          {
                            "Ref": "Partition"
                          },
                          ":s3:::elasticbeanstalk-*-",
                          {
                            "Ref": "AWS::AccountId"
                          },
                          "-*/*"
                        ]
                      ]
                    }
                  ]
                },
                {
                  "Sid": "ECSAccess",
                  "Effect": "Allow",
                  "Action": [
                    "ecs:StartTask",
                    "ecs:StopTask",
                    "ecs:RegisterContainerInstance",
                    "ecs:DeregisterContainerInstance",
                    "ecs:DescribeContainerInstances",
                    "ecs:DiscoverPollEndpoint",
                    "ecs:Submit*",
                    "ecs:Poll"
                  ],
                  "Resource": "*"
                },
                {
                  "Sid": "QueueAccess",
                  "Action": [
                    "sqs:ChangeMessageVisibility",
                    "sqs:DeleteMessage",
                    "sqs:ReceiveMessage",
                    "sqs:SendMessage"
                  ],
                  "Effect": "Allow",
                  "Resource": "*"
                },
                {
                  "Sid": "DynamoPeriodicTasks",
                  "Action": [
                    "dynamodb:BatchGetItem",
                    "dynamodb:BatchWriteItem",
                    "dynamodb:DeleteItem",
                    "dynamodb:GetItem",
                    "dynamodb:PutItem",
                    "dynamodb:Query",
                    "dynamodb:Scan",
                    "dynamodb:UpdateItem"
                  ],
                  "Effect": "Allow",
                  "Resource": [
                    {
                      "Fn::Join": [
                        "",
                        [
                          "arn:",
                          {
                            "Ref": "Partition"
                          },
                          ":dynamodb:*:",
                          {
                            "Ref": "AWS::AccountId"
                          },
                          ":table/*-stack-AWSEBWorkerCronLeaderRegistry*"
                        ]
                      ]
                    }
                  ]
                },
                {
                  "Sid": "MetricsAccess",
                  "Action": [
                    "cloudwatch:PutMetricData"
                  ],
                  "Effect": "Allow",
                  "Resource": "*"
                }
              ]
            }
          }
        ],
        "Path": "/"
      }
    }
  }
}
```

#### YAML
<a name="aws-resource-elasticbeanstalk-environment--examples--Custom_or_Supported_Platform--yaml"></a>

```
AWSTemplateFormatVersion: 2010-09-09
Description: Elasticbeanstalk test template
Parameters:
  BeanstalkService:
    Type: String
  Ec2Service:
    Type: String
  Partition:
    Type: String
  SolutionStackName:
    Type: String
  PlatformArn:
    Type: String
Resources:
  Application:
    Type: AWS::ElasticBeanstalk::Application
    Properties:
      ApplicationName: SampleBeanstalkApp
      Description: AWS Elastic Beanstalk Python Sample Application
  AppVersion:
    Type: AWS::ElasticBeanstalk::ApplicationVersion
    Properties:
      ApplicationName: !Ref Application
      Description: Version 1.0
      SourceBundle:
        S3Bucket: Fn::Join:
          - '-'
          - 
          - 'elasticbeanstalk-samples'
          - !Ref 'AWS::Region'
        S3Key: python-sample-20150402.zip
  Environment:
    Type: AWS::ElasticBeanstalk::Environment
    Properties:
      ApplicationName: !Ref Application
      Description: AWS Elastic Beanstalk Environment running Python Sample Application
      PlatformArn: !Ref PlatformArn
      SolutionStackName: !Ref SolutionStackName
      VersionLabel: !Ref AppVersion
      OptionSettings:
        - Namespace: 'aws:autoscaling:launchconfiguration'
          OptionName: IamInstanceProfile
          Value: !Ref InstanceProfile
        - Namespace: 'aws:elasticbeanstalk:environment'
          OptionName: ServiceRole
          Value: !Ref ServiceRole
  ServiceRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Sid: ''
            Effect: Allow
            Principal:
              Service: !Ref BeanstalkService
            Action: 'sts:AssumeRole'
            Condition:
              StringEquals:
                'sts:ExternalId': elasticbeanstalk
      Policies:
        - PolicyName: root
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Effect: Allow
                Action:
                  - 'elasticloadbalancing:DescribeInstanceHealth'
                  - 'ec2:DescribeInstances'
                  - 'ec2:DescribeInstanceStatus'
                  - 'ec2:GetConsoleOutput'
                  - 'ec2:AssociateAddress'
                  - 'ec2:DescribeAddresses'
                  - 'ec2:DescribeSecurityGroups'
                  - 'sqs:GetQueueAttributes'
                  - 'sqs:GetQueueUrl'
                  - 'autoscaling:DescribeAutoScalingGroups'
                  - 'autoscaling:DescribeAutoScalingInstances'
                  - 'autoscaling:DescribeScalingActivities'
                  - 'autoscaling:DescribeNotificationConfigurations'
                Resource:
                  - '*'
      Path: /
  InstanceProfile:
    Type: AWS::IAM::InstanceProfile
    Properties:
      Path: /
      Roles:
        - !Ref InstanceProfileRole
  InstanceProfileRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - !Ref Ec2Service
            Action:
              - 'sts:AssumeRole'
      Policies:
        - PolicyName: root
          PolicyDocument:
            Version: 2012-10-17
            Statement:
              - Sid: BucketAccess
                Action:
                  - 's3:Get*'
                  - 's3:List*'
                  - 's3:PutObject'
                Effect: Allow
                Resource:
                  - !Join 
                    - ''
                    - - 'arn:'
                      - !Ref Partition
                      - ':s3:::elasticbeanstalk-*-'
                      - !Ref 'AWS::AccountId'
                  - !Join 
                    - ''
                    - - 'arn:'
                      - !Ref Partition
                      - ':s3:::elasticbeanstalk-*-'
                      - !Ref 'AWS::AccountId'
                      - /*
                  - !Join 
                    - ''
                    - - 'arn:'
                      - !Ref Partition
                      - ':s3:::elasticbeanstalk-*-'
                      - !Ref 'AWS::AccountId'
                      - '-*'
                  - !Join 
                    - ''
                    - - 'arn:'
                      - !Ref Partition
                      - ':s3:::elasticbeanstalk-*-'
                      - !Ref 'AWS::AccountId'
                      - '-*/*'
              - Sid: ECSAccess
                Effect: Allow
                Action:
                  - 'ecs:StartTask'
                  - 'ecs:StopTask'
                  - 'ecs:RegisterContainerInstance'
                  - 'ecs:DeregisterContainerInstance'
                  - 'ecs:DescribeContainerInstances'
                  - 'ecs:DiscoverPollEndpoint'
                  - 'ecs:Submit*'
                  - 'ecs:Poll'
                Resource: '*'
              - Sid: QueueAccess
                Action:
                  - 'sqs:ChangeMessageVisibility'
                  - 'sqs:DeleteMessage'
                  - 'sqs:ReceiveMessage'
                  - 'sqs:SendMessage'
                Effect: Allow
                Resource: '*'
              - Sid: DynamoPeriodicTasks
                Action:
                  - 'dynamodb:BatchGetItem'
                  - 'dynamodb:BatchWriteItem'
                  - 'dynamodb:DeleteItem'
                  - 'dynamodb:GetItem'
                  - 'dynamodb:PutItem'
                  - 'dynamodb:Query'
                  - 'dynamodb:Scan'
                  - 'dynamodb:UpdateItem'
                Effect: Allow
                Resource:
                  - !Join 
                    - ''
                    - - 'arn:'
                      - !Ref Partition
                      - ':dynamodb:*:'
                      - !Ref 'AWS::AccountId'
                      - ':table/*-stack-AWSEBWorkerCronLeaderRegistry*'
              - Sid: MetricsAccess
                Action:
                  - 'cloudwatch:PutMetricData'
                Effect: Allow
                Resource: '*'
      Path: /
```

## See also
<a name="aws-resource-elasticbeanstalk-environment--seealso"></a>
+ [Creating an AWS Elastic Beanstalk Environment](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.environments.html) in the *AWS Elastic Beanstalk Developer Guide*
+ [Managing Environments](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.html) in the *AWS Elastic Beanstalk Developer Guide*
+ For a complete Elastic Beanstalk sample template, see [Elastic Beanstalk Template Snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-elasticbeanstalk.html).

# AWS::ElasticBeanstalk::Environment OptionSetting
<a name="aws-properties-elasticbeanstalk-environment-optionsetting"></a>

The `OptionSetting` property type specifies an option for an AWS Elastic Beanstalk environment.

The `OptionSettings` property of the [AWS::ElasticBeanstalk::Environment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html) resource contains a list of `OptionSetting` property types.

For a list of possible namespaces and option values, see [Option Values](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html) in the *AWS Elastic Beanstalk Developer Guide*.

## Syntax
<a name="aws-properties-elasticbeanstalk-environment-optionsetting-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-elasticbeanstalk-environment-optionsetting-syntax.json"></a>

```
{
  "[Namespace](#cfn-elasticbeanstalk-environment-optionsetting-namespace)" : String,
  "[OptionName](#cfn-elasticbeanstalk-environment-optionsetting-optionname)" : String,
  "[ResourceName](#cfn-elasticbeanstalk-environment-optionsetting-resourcename)" : String,
  "[Value](#cfn-elasticbeanstalk-environment-optionsetting-value)" : String
}
```

### YAML
<a name="aws-properties-elasticbeanstalk-environment-optionsetting-syntax.yaml"></a>

```
  [Namespace](#cfn-elasticbeanstalk-environment-optionsetting-namespace): String
  [OptionName](#cfn-elasticbeanstalk-environment-optionsetting-optionname): String
  [ResourceName](#cfn-elasticbeanstalk-environment-optionsetting-resourcename): String
  [Value](#cfn-elasticbeanstalk-environment-optionsetting-value): String
```

## Properties
<a name="aws-properties-elasticbeanstalk-environment-optionsetting-properties"></a>

`Namespace`  <a name="cfn-elasticbeanstalk-environment-optionsetting-namespace"></a>
A unique namespace that identifies the option's associated AWS resource.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`OptionName`  <a name="cfn-elasticbeanstalk-environment-optionsetting-optionname"></a>
The name of the configuration option.  
*Required*: Yes  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ResourceName`  <a name="cfn-elasticbeanstalk-environment-optionsetting-resourcename"></a>
A unique resource name for the option setting. Use it for a time–based scaling configuration option.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-elasticbeanstalk-environment-optionsetting-value"></a>
The current value for the configuration option.  
*Required*: No  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## See also
<a name="aws-properties-elasticbeanstalk-environment-optionsetting--seealso"></a>
+ [ConfigurationOptionSetting](https://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_ConfigurationOptionSetting.html) in the *AWS Elastic Beanstalk API Reference*
+ [Configuration Options](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options.html) in the *AWS Elastic Beanstalk Developer Guide*

# AWS::ElasticBeanstalk::Environment Tag
<a name="aws-properties-elasticbeanstalk-environment-tag"></a>

Describes a tag applied to a resource in an environment.

## Syntax
<a name="aws-properties-elasticbeanstalk-environment-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-elasticbeanstalk-environment-tag-syntax.json"></a>

```
{
  "[Key](#cfn-elasticbeanstalk-environment-tag-key)" : String,
  "[Value](#cfn-elasticbeanstalk-environment-tag-value)" : String
}
```

### YAML
<a name="aws-properties-elasticbeanstalk-environment-tag-syntax.yaml"></a>

```
  [Key](#cfn-elasticbeanstalk-environment-tag-key): String
  [Value](#cfn-elasticbeanstalk-environment-tag-value): String
```

## Properties
<a name="aws-properties-elasticbeanstalk-environment-tag-properties"></a>

`Key`  <a name="cfn-elasticbeanstalk-environment-tag-key"></a>
The key of the tag.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-elasticbeanstalk-environment-tag-value"></a>
The value of the tag.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::ElasticBeanstalk::Environment Tier
<a name="aws-properties-elasticbeanstalk-environment-tier"></a>

Describes the environment tier for an [AWS::ElasticBeanstalk::Environment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-beanstalk-environment.html) resource. For more information, see [Environment Tiers](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html) in the *AWS Elastic Beanstalk Developer Guide*.

## Syntax
<a name="aws-properties-elasticbeanstalk-environment-tier-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-elasticbeanstalk-environment-tier-syntax.json"></a>

```
{
  "[Name](#cfn-elasticbeanstalk-environment-tier-name)" : String,
  "[Type](#cfn-elasticbeanstalk-environment-tier-type)" : String,
  "[Version](#cfn-elasticbeanstalk-environment-tier-version)" : String
}
```

### YAML
<a name="aws-properties-elasticbeanstalk-environment-tier-syntax.yaml"></a>

```
  [Name](#cfn-elasticbeanstalk-environment-tier-name): String
  [Type](#cfn-elasticbeanstalk-environment-tier-type): String
  [Version](#cfn-elasticbeanstalk-environment-tier-version): String
```

## Properties
<a name="aws-properties-elasticbeanstalk-environment-tier-properties"></a>

`Name`  <a name="cfn-elasticbeanstalk-environment-tier-name"></a>
The name of this environment tier.  
Valid values:  
+ For *Web server tier* – `WebServer`
+ For *Worker tier* – `Worker`
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Type`  <a name="cfn-elasticbeanstalk-environment-tier-type"></a>
The type of this environment tier.  
Valid values:  
+ For *Web server tier* – `Standard`
+ For *Worker tier* – `SQS/HTTP`
*Required*: No  
*Type*: String  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Version`  <a name="cfn-elasticbeanstalk-environment-tier-version"></a>
The version of this environment tier. When you don't set a value to it, Elastic Beanstalk uses the latest compatible worker tier version.  
This member is deprecated. Any specific version that you set may become out of date. We recommend leaving it unspecified.
*Required*: No  
*Type*: String  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)