Skip to content
v2.278.0

CfnBranchProps Struct ​

Properties for defining a CfnBranch.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_amplify as amplify } from 'aws-cdk-lib';
const cfnBranchProps: amplify.CfnBranchProps = {
  appId: 'appId',
  branchName: 'branchName',

  // the properties below are optional
  backend: {
    stackArn: 'stackArn',
  },
  basicAuthConfig: {
    password: 'password',
    username: 'username',

    // the properties below are optional
    enableBasicAuth: false,
  },
  buildSpec: 'buildSpec',
  computeRoleArn: 'computeRoleArn',
  description: 'description',
  enableAutoBuild: false,
  enablePerformanceMode: false,
  enablePullRequestPreview: false,
  enableSkewProtection: false,
  environmentVariables: [{
    name: 'name',
    value: 'value',
  }],
  framework: 'framework',
  pullRequestEnvironmentName: 'pullRequestEnvironmentName',
  stage: 'stage',
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_amplify as amplify

cfn_branch_props = amplify.CfnBranchProps(
    app_id="appId",
    branch_name="branchName",

    # the properties below are optional
    backend=amplify.CfnBranch.BackendProperty(
        stack_arn="stackArn"
    ),
    basic_auth_config=amplify.CfnBranch.BasicAuthConfigProperty(
        password="password",
        username="username",

        # the properties below are optional
        enable_basic_auth=False
    ),
    build_spec="buildSpec",
    compute_role_arn="computeRoleArn",
    description="description",
    enable_auto_build=False,
    enable_performance_mode=False,
    enable_pull_request_preview=False,
    enable_skew_protection=False,
    environment_variables=[amplify.CfnBranch.EnvironmentVariableProperty(
        name="name",
        value="value"
    )],
    framework="framework",
    pull_request_environment_name="pullRequestEnvironmentName",
    stage="stage",
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.amplify.*;

CfnBranchProps cfnBranchProps = CfnBranchProps.builder()
        .appId("appId")
        .branchName("branchName")

        // the properties below are optional
        .backend(BackendProperty.builder()
                .stackArn("stackArn")
                .build())
        .basicAuthConfig(BasicAuthConfigProperty.builder()
                .password("password")
                .username("username")

                // the properties below are optional
                .enableBasicAuth(false)
                .build())
        .buildSpec("buildSpec")
        .computeRoleArn("computeRoleArn")
        .description("description")
        .enableAutoBuild(false)
        .enablePerformanceMode(false)
        .enablePullRequestPreview(false)
        .enableSkewProtection(false)
        .environmentVariables(List.of(EnvironmentVariableProperty.builder()
                .name("name")
                .value("value")
                .build()))
        .framework("framework")
        .pullRequestEnvironmentName("pullRequestEnvironmentName")
        .stage("stage")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Amplify;

var cfnBranchProps = new CfnBranchProps {
    AppId = "appId",
    BranchName = "branchName",

    // the properties below are optional
    Backend = new BackendProperty {
        StackArn = "stackArn"
    },
    BasicAuthConfig = new BasicAuthConfigProperty {
        Password = "password",
        Username = "username",

        // the properties below are optional
        EnableBasicAuth = false
    },
    BuildSpec = "buildSpec",
    ComputeRoleArn = "computeRoleArn",
    Description = "description",
    EnableAutoBuild = false,
    EnablePerformanceMode = false,
    EnablePullRequestPreview = false,
    EnableSkewProtection = false,
    EnvironmentVariables = new [] { new EnvironmentVariableProperty {
        Name = "name",
        Value = "value"
    } },
    Framework = "framework",
    PullRequestEnvironmentName = "pullRequestEnvironmentName",
    Stage = "stage",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnBranchProps := &CfnBranchProps{
	AppId: jsii.String("appId"),
	BranchName: jsii.String("branchName"),

	// the properties below are optional
	Backend: &BackendProperty{
		StackArn: jsii.String("stackArn"),
	},
	BasicAuthConfig: &BasicAuthConfigProperty{
		Password: jsii.String("password"),
		Username: jsii.String("username"),

		// the properties below are optional
		EnableBasicAuth: jsii.Boolean(false),
	},
	BuildSpec: jsii.String("buildSpec"),
	ComputeRoleArn: jsii.String("computeRoleArn"),
	Description: jsii.String("description"),
	EnableAutoBuild: jsii.Boolean(false),
	EnablePerformanceMode: jsii.Boolean(false),
	EnablePullRequestPreview: jsii.Boolean(false),
	EnableSkewProtection: jsii.Boolean(false),
	EnvironmentVariables: []interface{}{
		&EnvironmentVariableProperty{
			Name: jsii.String("name"),
			Value: jsii.String("value"),
		},
	},
	Framework: jsii.String("framework"),
	PullRequestEnvironmentName: jsii.String("pullRequestEnvironmentName"),
	Stage: jsii.String("stage"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

appIdstringapp_idstrappIdStringAppIdstringAppId*string required #
The unique ID for an Amplify app.
backendoptionalIResolvable | CfnBranch.BackendPropertybackendoptionaltyping.Union[IResolvable, BackendProperty]backendoptionalIResolvableBackendoptionalIResolvableBackendoptionalinterface{} #
The backend for a `Branch` of an Amplify app. Use for a backend created from an CloudFormation stack.

This field is available to Amplify Gen 2 apps only. When you deploy an application with Amplify Gen 2, you provision the app's backend infrastructure using Typescript code.

basicAuthConfigoptionalIResolvable | CfnBranch.BasicAuthConfigPropertybasic_auth_configoptionaltyping.Union[IResolvable, BasicAuthConfigProperty]basicAuthConfigoptionalIResolvableBasicAuthConfigoptionalIResolvableBasicAuthConfigoptionalinterface{} #
The basic authorization credentials for a branch of an Amplify app.

You must base64-encode the authorization credentials and provide them in the format user:password .

branchNamestringbranch_namestrbranchNameStringBranchNamestringBranchName*string required #
The name for the branch.
buildSpecoptionalstringbuild_specoptionalstrbuildSpecoptionalStringBuildSpecoptionalstringBuildSpecoptional*string #
The build specification (build spec) for the branch.
computeRoleArnoptionalstringcompute_role_arnoptionalstrcomputeRoleArnoptionalStringComputeRoleArnoptionalstringComputeRoleArnoptional*string #
The Amazon Resource Name (ARN) of the IAM role to assign to a branch of an SSR app.
notes

The SSR Compute role allows the Amplify Hosting compute service to securely access specific AWS resources based on the role's permissions. For more information about the SSR Compute role, see Adding an SSR Compute role in the Amplify User Guide .

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string #
The description for the branch that is part of an Amplify app.
enableAutoBuildoptionalboolean | IResolvableenable_auto_buildoptionaltyping.Union[bool, IResolvable]enableAutoBuildoptionalBooleanEnableAutoBuildoptionalboolEnableAutoBuildoptionalinterface{} #
Enables auto building for the branch.
enablePerformanceModeoptionalboolean | IResolvableenable_performance_modeoptionaltyping.Union[bool, IResolvable]enablePerformanceModeoptionalBooleanEnablePerformanceModeoptionalboolEnablePerformanceModeoptionalinterface{} #
Enables performance mode for the branch.

Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out.

enablePullRequestPreviewoptionalboolean | IResolvableenable_pull_request_previewoptionaltyping.Union[bool, IResolvable]enablePullRequestPreviewoptionalBooleanEnablePullRequestPreviewoptionalboolEnablePullRequestPreviewoptionalinterface{} #
Specifies whether Amplify Hosting creates a preview for each pull request that is made for this branch.
notes

If this property is enabled, Amplify deploys your app to a unique preview URL after each pull request is opened. Development and QA teams can use this preview to test the pull request before it's merged into a production or integration branch.

To provide backend support for your preview, Amplify automatically provisions a temporary backend environment that it deletes when the pull request is closed. If you want to specify a dedicated backend environment for your previews, use the PullRequestEnvironmentName property.

For more information, see Web Previews in the AWS Amplify Hosting User Guide .

enableSkewProtectionoptionalboolean | IResolvableenable_skew_protectionoptionaltyping.Union[bool, IResolvable]enableSkewProtectionoptionalBooleanEnableSkewProtectionoptionalboolEnableSkewProtectionoptionalinterface{} #
Specifies whether the skew protection feature is enabled for the branch.
notes

Deployment skew protection is available to Amplify applications to eliminate version skew issues between client and servers in web applications. When you apply skew protection to a branch, you can ensure that your clients always interact with the correct version of server-side assets, regardless of when a deployment occurs. For more information about skew protection, see Skew protection for Amplify deployments in the Amplify User Guide .

environmentVariablesoptionalIResolvable | IResolvable | CfnBranch.EnvironmentVariableProperty[]environment_variablesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, EnvironmentVariableProperty]]]environmentVariablesoptionalIResolvableEnvironmentVariablesoptionalIResolvableEnvironmentVariablesoptionalinterface{} #
The environment variables for the branch.
frameworkoptionalstringframeworkoptionalstrframeworkoptionalStringFrameworkoptionalstringFrameworkoptional*string #
The framework for the branch.
pullRequestEnvironmentNameoptionalstringpull_request_environment_nameoptionalstrpullRequestEnvironmentNameoptionalStringPullRequestEnvironmentNameoptionalstringPullRequestEnvironmentNameoptional*string #
If pull request previews are enabled for this branch, you can use this property to specify a dedicated backend environment for your previews.
notes

For example, you could specify an environment named prod , test , or dev that you initialized with the Amplify CLI and mapped to this branch.

To enable pull request previews, set the EnablePullRequestPreview property to true .

If you don't specify an environment, Amplify Hosting provides backend support for each preview by automatically provisioning a temporary backend environment. Amplify Hosting deletes this environment when the pull request is closed.

For more information about creating backend environments, see Feature Branch Deployments and Team Workflows in the AWS Amplify Hosting User Guide .

stageoptionalstringstageoptionalstrstageoptionalStringStageoptionalstringStageoptional*string #
Describes the current stage for the branch.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
The tag for the branch.