

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

# AWS::AmplifyGen3::Environment EnvironmentVariable

An environment variable to set.

## Syntax
<a name="aws-properties-amplifygen3-environment-environmentvariable-syntax"></a>

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

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

```json
{
  "[Comment](#cfn-amplifygen3-environment-environmentvariable-comment)" : {{String}},
  "[Key](#cfn-amplifygen3-environment-environmentvariable-key)" : {{String}},
  "[Scope](#cfn-amplifygen3-environment-environmentvariable-scope)" : {{String}},
  "[Type](#cfn-amplifygen3-environment-environmentvariable-type)" : {{String}},
  "[Value](#cfn-amplifygen3-environment-environmentvariable-value)" : {{String}}
}
```

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

```yaml
  [Comment](#cfn-amplifygen3-environment-environmentvariable-comment): {{String}}
  [Key](#cfn-amplifygen3-environment-environmentvariable-key): {{String}}
  [Scope](#cfn-amplifygen3-environment-environmentvariable-scope): {{String}}
  [Type](#cfn-amplifygen3-environment-environmentvariable-type): {{String}}
  [Value](#cfn-amplifygen3-environment-environmentvariable-value): {{String}}
```

## Properties
<a name="aws-properties-amplifygen3-environment-environmentvariable-properties"></a>

`Comment`  <a name="cfn-amplifygen3-environment-environmentvariable-comment"></a>
An optional comment describing the environment variable.  
*Required*: No  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `1024`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Key`  <a name="cfn-amplifygen3-environment-environmentvariable-key"></a>
The key of the environment variable.  
*Required*: Yes  
*Type*: String  
*Pattern*: `^[a-zA-Z]([a-zA-Z0-9_])*$`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Scope`  <a name="cfn-amplifygen3-environment-environmentvariable-scope"></a>
The scope where the environment variable is available. Valid values:  
+ ALL: The variable is available to the build and the runtime.
+ BACKEND: The variable is available only to the app's backend, not to the build or the runtime.
The default is ALL.  
*Required*: No  
*Type*: String  
*Allowed values*: `ALL | BACKEND`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Type`  <a name="cfn-amplifygen3-environment-environmentvariable-type"></a>
The type of the environment variable. Valid values:  
+ PLAINTEXT: The value is returned when you read the variable.
+ SENSITIVE: The value is omitted when you read the variable.
*Required*: Yes  
*Type*: String  
*Allowed values*: `PLAINTEXT | SENSITIVE`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Value`  <a name="cfn-amplifygen3-environment-environmentvariable-value"></a>
The value of the environment variable.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `4096`  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)