

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::App

The `AWS::AmplifyGen3::App` resource specifies an Amazon Amplify Gen 3 app. An app connects to a source repository and always has two environments, a production environment and a preview environment, which you configure with the `ProductionEnvironment` and `PreviewEnvironment` properties.

To add more environments to an app, use the `AWS::AmplifyGen3::Environment` resource.

## Syntax
<a name="aws-resource-amplifygen3-app-syntax"></a>

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

### JSON
<a name="aws-resource-amplifygen3-app-syntax.json"></a>

```json
{
  "Type" : "AWS::AmplifyGen3::App",
  "Properties" : {
      "[AppName](#cfn-amplifygen3-app-appname)" : {{String}},
      "[Backend](#cfn-amplifygen3-app-backend)" : {{AppBackend}},
      "[PreviewEnvironment](#cfn-amplifygen3-app-previewenvironment)" : {{PrescribedEnvironment}},
      "[ProductionEnvironment](#cfn-amplifygen3-app-productionenvironment)" : {{PrescribedEnvironment}},
      "[SourceConfig](#cfn-amplifygen3-app-sourceconfig)" : {{AppSourceConfig}},
      "[Tags](#cfn-amplifygen3-app-tags)" : {{[ Tag, ... ]}},
      "[Web](#cfn-amplifygen3-app-web)" : {{AppWeb}}
    }
}
```

### YAML
<a name="aws-resource-amplifygen3-app-syntax.yaml"></a>

```yaml
Type: AWS::AmplifyGen3::App
Properties:
  [AppName](#cfn-amplifygen3-app-appname): {{String}}
  [Backend](#cfn-amplifygen3-app-backend): {{
    AppBackend}}
  [PreviewEnvironment](#cfn-amplifygen3-app-previewenvironment): {{
    PrescribedEnvironment}}
  [ProductionEnvironment](#cfn-amplifygen3-app-productionenvironment): {{
    PrescribedEnvironment}}
  [SourceConfig](#cfn-amplifygen3-app-sourceconfig): {{
    AppSourceConfig}}
  [Tags](#cfn-amplifygen3-app-tags): {{
    - Tag}}
  [Web](#cfn-amplifygen3-app-web): {{
    AppWeb}}
```

## Properties
<a name="aws-resource-amplifygen3-app-properties"></a>

`AppName`  <a name="cfn-amplifygen3-app-appname"></a>
The name of the app.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `40`  
*Update requires*: [Replacement](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Backend`  <a name="cfn-amplifygen3-app-backend"></a>
The backend settings for the app. An empty object adds a backend with default settings. Removing this property deletes the backend and its data.  
*Required*: No  
*Type*: [AppBackend](aws-properties-amplifygen3-app-appbackend.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PreviewEnvironment`  <a name="cfn-amplifygen3-app-previewenvironment"></a>
The configuration of the app's preview environment.  
*Required*: Yes  
*Type*: [PrescribedEnvironment](aws-properties-amplifygen3-app-prescribedenvironment.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ProductionEnvironment`  <a name="cfn-amplifygen3-app-productionenvironment"></a>
The configuration of the app's production environment.  
*Required*: Yes  
*Type*: [PrescribedEnvironment](aws-properties-amplifygen3-app-prescribedenvironment.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SourceConfig`  <a name="cfn-amplifygen3-app-sourceconfig"></a>
The source configuration for the app.  
*Required*: No  
*Type*: [AppSourceConfig](aws-properties-amplifygen3-app-appsourceconfig.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Tags`  <a name="cfn-amplifygen3-app-tags"></a>
An array of key-value pairs to apply to this resource.  
For more information, see [Tag](https://docs.amazonaws.cn/AWSCloudFormation/latest/TemplateReference/aws-properties-resource-tags.html).  
*Required*: No  
*Type*: Array of [Tag](aws-properties-amplifygen3-app-tag.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Web`  <a name="cfn-amplifygen3-app-web"></a>
The web hosting settings for the app.  
*Required*: No  
*Type*: [AppWeb](aws-properties-amplifygen3-app-appweb.md)  
*Update requires*: [No interruption](https://docs.amazonaws.cn/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-amplifygen3-app-return-values"></a>

### Ref
<a name="aws-resource-amplifygen3-app-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the ARN of the app.

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

### Fn::GetAtt
<a name="aws-resource-amplifygen3-app-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 [`Fn::GetAtt`](https://docs.amazonaws.cn/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-amplifygen3-app-return-values-fn--getatt-fn--getatt"></a>

`AppArn`  <a name="AppArn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the app.

`CreatedAt`  <a name="CreatedAt-fn::getatt"></a>
The time at which the app was created. The value is in ISO-8601 format.

`PreviewEnvironment.Backend.DatabaseLogConfig.CloudWatchLogsConfig.LogGroupArn`  <a name="PreviewEnvironment.Backend.DatabaseLogConfig.CloudWatchLogsConfig.LogGroupArn-fn::getatt"></a>
The ARN of the Amazon CloudWatch Logs log group that receives the environment's database logs.

`PreviewEnvironment.CreatedAt`  <a name="PreviewEnvironment.CreatedAt-fn::getatt"></a>
The time at which the environment was created. The value is in ISO-8601 format.

`PreviewEnvironment.EnvironmentArn`  <a name="PreviewEnvironment.EnvironmentArn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the environment.

`PreviewEnvironment.EnvironmentName`  <a name="PreviewEnvironment.EnvironmentName-fn::getatt"></a>
The name of the environment.

`PreviewEnvironment.Web.AccessLogConfig.CloudWatchLogsConfig.LogGroupArn`  <a name="PreviewEnvironment.Web.AccessLogConfig.CloudWatchLogsConfig.LogGroupArn-fn::getatt"></a>
The ARN of the Amazon CloudWatch Logs log group that receives the environment's access logs.

`ProductionEnvironment.Backend.DatabaseLogConfig.CloudWatchLogsConfig.LogGroupArn`  <a name="ProductionEnvironment.Backend.DatabaseLogConfig.CloudWatchLogsConfig.LogGroupArn-fn::getatt"></a>
The ARN of the Amazon CloudWatch Logs log group that receives the environment's database logs.

`ProductionEnvironment.CreatedAt`  <a name="ProductionEnvironment.CreatedAt-fn::getatt"></a>
The time at which the environment was created. The value is in ISO-8601 format.

`ProductionEnvironment.EnvironmentArn`  <a name="ProductionEnvironment.EnvironmentArn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the environment.

`ProductionEnvironment.EnvironmentName`  <a name="ProductionEnvironment.EnvironmentName-fn::getatt"></a>
The name of the environment.

`ProductionEnvironment.Web.AccessLogConfig.CloudWatchLogsConfig.LogGroupArn`  <a name="ProductionEnvironment.Web.AccessLogConfig.CloudWatchLogsConfig.LogGroupArn-fn::getatt"></a>
The ARN of the Amazon CloudWatch Logs log group that receives the environment's access logs.

## Examples
<a name="aws-resource-amplifygen3-app--examples"></a>

### Create an app with production and preview environments
<a name="aws-resource-amplifygen3-app--examples--Create_an_app_with_production_and_preview_environments"></a>

The following example creates an app with web build settings. The production environment rolls out each deployment all at once.

#### JSON
<a name="aws-resource-amplifygen3-app--examples--Create_an_app_with_production_and_preview_environments--json"></a>

```json
{
    "Resources": {
        "MyApp": {
            "Type": "AWS::AmplifyGen3::App",
            "Properties": {
                "AppName": "my-app",
                "Web": {
                    "BuildConfig": {
                        "InstallCommand": "npm ci",
                        "BuildCommand": "npm run build",
                        "OutputDirectory": "dist"
                    }
                },
                "ProductionEnvironment": {
                    "EnvironmentRoleArn": "arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole",
                    "GradualRolloutConfig": {
                        "PresetConfig": {
                            "Preset": "ALL_AT_ONCE"
                        }
                    }
                },
                "PreviewEnvironment": {
                    "EnvironmentRoleArn": "arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole"
                },
                "Tags": [
                    {
                        "Key": "team",
                        "Value": "web"
                    }
                ]
            }
        }
    }
}
```

#### YAML
<a name="aws-resource-amplifygen3-app--examples--Create_an_app_with_production_and_preview_environments--yaml"></a>

```yaml
Resources:
  MyApp:
    Type: AWS::AmplifyGen3::App
    Properties:
      AppName: my-app
      Web:
        BuildConfig:
          InstallCommand: npm ci
          BuildCommand: npm run build
          OutputDirectory: dist
      ProductionEnvironment:
        EnvironmentRoleArn: arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole
        GradualRolloutConfig:
          PresetConfig:
            Preset: ALL_AT_ONCE
      PreviewEnvironment:
        EnvironmentRoleArn: arn:aws:iam::123456789012:role/AmplifyGen3EnvironmentRole
      Tags:
      - Key: team
        Value: web
```