AWS Amplify Console Branch
This page shows how to write Terraform and CloudFormation for Amplify Console Branch and write them securely.
aws_amplify_branch (Terraform)
The Branch in Amplify Console can be configured in Terraform with the resource name aws_amplify_branch
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_amplify_branch" "dev" {
app_id = aws_amplify_app.jay-biesh-site.id
branch_name = "dev"
stage = "DEVELOPMENT"
resource "aws_amplify_branch" "master" {
app_id = aws_amplify_app.testofamplify.id
branch_name = var.git_production_branch
framework = "React"
stage = "PRODUCTION"
resource "aws_amplify_branch" "develop" {
app_id = aws_amplify_app.front_app.id
branch_name = "main"
stage = "PRODUCTION"
enable_auto_build = true
}
resource "aws_amplify_branch" "main" {
app_id = aws_amplify_app.app2.id
branch_name = "main"
stage = "PRODUCTION"
resource "aws_amplify_branch" "master" {
app_id = aws_amplify_app.app.id
branch_name = var.Branch
stage = var.Stage
Parameters
The following arguments are supported:
app_id
- (Required) The unique ID for an Amplify app.branch_name
- (Required) The name for the branch.backend_environment_arn
- (Optional) The Amazon Resource Name (ARN) for a backend environment that is part of an Amplify app.basic_auth_credentials
- (Optional) The basic authorization credentials for the branch.description
- (Optional) The description for the branch.display_name
- (Optional) The display name for a branch. This is used as the default domain prefix.enable_auto_build
- (Optional) Enables auto building for the branch.enable_basic_auth
- (Optional) Enables basic authorization for the branch.enable_notification
- (Optional) Enables notifications for the branch.enable_performance_mode
- (Optional) Enables performance mode for the branch.enable_pull_request_preview
- (Optional) Enables pull request previews for this branch.environment_variables
- (Optional) The environment variables for the branch.framework
- (Optional) The framework for the branch.pull_request_environment_name
- (Optional) The Amplify environment name for the pull request.stage
- (Optional) Describes the current stage for the branch. Valid values:PRODUCTION
,BETA
,DEVELOPMENT
,EXPERIMENTAL
,PULL_REQUEST
.tags
- (Optional) Key-value mapping of resource tags. If configured with a providerdefault_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.ttl
- (Optional) The content Time To Live (TTL) for the website in seconds.
In addition to all arguments above, the following attributes are exported:
arn
- The Amazon Resource Name (ARN) for the branch.associated_resources
- A list of custom resources that are linked to this branch.custom_domains
- The custom domains for the branch.destination_branch
- The destination branch if the branch is a pull request branch.source_branch
- The source branch if the branch is a pull request branch.tags_all
- A map of tags assigned to the resource, including those inherited from the providerdefault_tags
configuration block.
Explanation in Terraform Registry
Provides an Amplify Branch resource.
AWS::Amplify::Branch (CloudFormation)
The Branch in Amplify can be configured in CloudFormation with the resource name AWS::Amplify::Branch
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::Amplify::Branch
Properties:
BranchName: !Ref Branch
AppId: !GetAtt AmplifyApp.AppId
EnableAutoBuild: true
Type: 'AWS::Amplify::Branch'
Properties:
BranchName: 'develop'
AppId: !GetAtt 'AmplifyApp.AppId'
# BasicAuthConfig:
# EnableBasicAuth: true
Type: AWS::Amplify::Branch
Properties:
AppId: !GetAtt AmplifyApp.AppId
BranchName: ${{self:custom.branch}}
EnableAutoBuild: true
Stage: ${{self:custom.amplifyStage}}
Type: AWS::Amplify::Branch
Properties:
AppId: foo
BranchName: bar
BasicAuthConfig:
Password: !Ref AmplifyBranchBasicAuthConfigPassword
Type: AWS::Amplify::Branch
Properties:
AppId: foo
BranchName: bar
BasicAuthConfig:
Password: !Ref AmplifyBranchBasicAuthConfigPassword
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
"Type": "AWS::Amplify::Branch",
"Properties": {
"BranchName": {
"Ref": "env"
},
"AppId": {
Parameters
-
AppId
required - String -
BasicAuthConfig
optional - BasicAuthConfig -
BranchName
required - String -
BuildSpec
optional - String -
Description
optional - String -
EnableAutoBuild
optional - Boolean -
EnablePerformanceMode
optional - Boolean -
EnablePullRequestPreview
optional - Boolean -
EnvironmentVariables
optional - List of EnvironmentVariable -
PullRequestEnvironmentName
optional - String -
Stage
optional - String -
Tags
optional - List of Tag
Explanation in CloudFormation Registry
The AWS::Amplify::Branch resource creates a new branch within an app.
Frequently asked questions
What is AWS Amplify Console Branch?
AWS Amplify Console Branch is a resource for Amplify Console of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amplify Console Branch?
For Terraform, the DasJayYa/jay_bieshaar_site, naoyahieda/terraform_amplify_cicd_example and Tiino1/serverless-webapp source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the paschalidi/deploy-cloudfomrations-stacks, claptime/claptime and OlawaleLasisi/CD4WebsiteWithAWSAmplify source code examples are useful. See the CloudFormation Example section for further details.