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.
AWS::AmplifyGen3::Environment
The AWS::AmplifyGen3::Environment resource specifies a custom environment of an Amazon Amplify Gen 3 app. Each environment has its own source configuration, IAM role, web hosting settings, and backend settings.
The production and preview environments that every app has are configured on the AWS::AmplifyGen3::App resource, not with this resource.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::AmplifyGen3::Environment", "Properties" : { "AppName" :String, "Backend" :EnvironmentBackend, "EnvironmentName" :String, "EnvironmentRoleArn" :String, "EnvironmentRolePermissionMode" :String, "EnvironmentVariables" :[ EnvironmentVariable, ... ], "GradualRolloutConfig" :GradualRolloutConfig, "NetworkConfig" :NetworkConfig, "SourceConfig" :EnvironmentSourceConfig, "Tags" :[ Tag, ... ], "WafLogConfigs" :[ WafLogConfig, ... ], "Web" :EnvironmentWeb} }
YAML
Type: AWS::AmplifyGen3::Environment Properties: AppName:StringBackend:EnvironmentBackendEnvironmentName:StringEnvironmentRoleArn:StringEnvironmentRolePermissionMode:StringEnvironmentVariables:- EnvironmentVariableGradualRolloutConfig:GradualRolloutConfigNetworkConfig:NetworkConfigSourceConfig:EnvironmentSourceConfigTags:- TagWafLogConfigs:- WafLogConfigWeb:EnvironmentWeb
Properties
AppName-
The name of the app that the environment belongs to.
Required: Yes
Type: String
Minimum:
1Maximum:
40Update requires: Replacement
Backend-
The backend settings for the environment.
Required: No
Type: EnvironmentBackend
Update requires: No interruption
EnvironmentName-
The name of the environment.
Required: Yes
Type: String
Minimum:
1Maximum:
40Update requires: Replacement
EnvironmentRoleArn-
The Amazon Resource Name (ARN) of the IAM role for the environment.
Required: Yes
Type: String
Minimum:
20Maximum:
2048Update requires: No interruption
EnvironmentRolePermissionMode-
The permission mode for the environment's IAM role.
Required: No
Type: String
Allowed values:
SCOPED | FULLUpdate requires: No interruption
EnvironmentVariables-
The environment variables for the environment. Changes take effect at the next deployment.
Required: No
Type: Array of EnvironmentVariable
Update requires: No interruption
GradualRolloutConfig-
The schedule that Amplify Gen 3 uses to shift traffic to a new deployment gradually.
Required: No
Type: GradualRolloutConfig
Update requires: No interruption
NetworkConfig-
The VPC network configuration for the environment.
Required: No
Type: NetworkConfig
Update requires: No interruption
SourceConfig-
The source configuration for the environment.
Required: No
Type: EnvironmentSourceConfig
Update requires: No interruption
-
An array of key-value pairs to apply to this resource.
For more information, see Tag.
Required: No
Type: Array of Tag
Update requires: No interruption
WafLogConfigs-
A list of the environment's Amazon WAF log configurations. Omitted when the environment has no WAF log configuration.
Required: No
Type: Array of WafLogConfig
Minimum:
1Maximum:
1Update requires: No interruption
Web-
The web hosting settings for the environment.
Required: No
Type: EnvironmentWeb
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the ARN of the environment.
For more information about using the Ref function, see Ref.
Fn::GetAtt
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 Fn::GetAtt.
Backend.DatabaseLogConfig.CloudWatchLogsConfig.LogGroupArn-
The ARN of the Amazon CloudWatch Logs log group that receives the environment's database logs.
CreatedAt-
The time at which the environment was created. The value is in ISO-8601 format.
EnvironmentArn-
The Amazon Resource Name (ARN) of the environment.
Type-
The type of the environment.
Web.AccessLogConfig.CloudWatchLogsConfig.LogGroupArn-
The ARN of the Amazon CloudWatch Logs log group that receives the environment's access logs.
Examples
Create a custom environment
The following example adds a staging environment to an existing app. The environment deploys pushes to the staging branch.
JSON
{ "Resources": { "StagingEnvironment": { "Type": "AWS::AmplifyGen3::Environment", "Properties": { "AppName": "my-app", "EnvironmentName": "staging", "EnvironmentRoleArn": "arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole", "SourceConfig": { "GitSource": { "BranchMatchPatterns": [ "staging" ] } }, "GradualRolloutConfig": { "PresetConfig": { "Preset": "ALL_AT_ONCE" } } } } } }
YAML
Resources: StagingEnvironment: Type: AWS::AmplifyGen3::Environment Properties: AppName: my-app EnvironmentName: staging EnvironmentRoleArn: arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole SourceConfig: GitSource: BranchMatchPatterns: - staging GradualRolloutConfig: PresetConfig: Preset: ALL_AT_ONCE