@aws-cdk_aws-amplify-alpha.App

class App (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Amplify.Alpha.App
Gogithub.com/aws/aws-cdk-go/awscdkamplifyalpha/v2#App
Javasoftware.amazon.awscdk.services.amplify.alpha.App
Pythonaws_cdk.aws_amplify_alpha.App
TypeScript (source)@aws-cdk/aws-amplify-alpha ยป App

Implements IConstruct, IDependable, IResource, IApp, IGrantable

An Amplify Console application.

Example

const amplifyApp = new amplify.App(this, 'MyApp', {
  sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
    owner: '<user>',
    repository: '<repo>',
    oauthToken: SecretValue.secretsManager('my-github-token'),
  }),
  autoBranchCreation: { // Automatically connect branches that match a pattern set
    patterns: ['feature/*', 'test/*'],
  },
  autoBranchDeletion: true, // Automatically disconnect a branch when you delete a branch from your repository
});

Initializer

new App(scope: Construct, id: string, props: AppProps)

Parameters

  • scope Construct
  • id string
  • props AppProps

Construct Props

NameTypeDescription
appName?๐Ÿ”นstringThe name for the application.
autoBranchCreation?๐Ÿ”นAutoBranchCreationThe auto branch creation configuration.
autoBranchDeletion?๐Ÿ”นbooleanAutomatically disconnect a branch in the Amplify Console when you delete a branch from your Git repository.
basicAuth?๐Ÿ”นBasicAuthThe Basic Auth configuration.
buildSpec?๐Ÿ”นBuildSpecBuildSpec for the application.
customResponseHeaders?๐Ÿ”นCustomResponseHeader[]The custom HTTP response headers for an Amplify app.
customRules?๐Ÿ”นCustomRule[]Custom rewrite/redirect rules for the application.
description?๐Ÿ”นstringA description for the application.
environmentVariables?๐Ÿ”น{ [string]: string }Environment variables for the application.
role?๐Ÿ”นIRoleThe IAM service role to associate with the application.
sourceCodeProvider?๐Ÿ”นISourceCodeProviderThe source code provider for this application.

appName?๐Ÿ”น

Type: string (optional, default: a CDK generated name)

The name for the application.


autoBranchCreation?๐Ÿ”น

Type: AutoBranchCreation (optional, default: no auto branch creation)

The auto branch creation configuration.

Use this to automatically create branches that match a certain pattern.


autoBranchDeletion?๐Ÿ”น

Type: boolean (optional, default: false)

Automatically disconnect a branch in the Amplify Console when you delete a branch from your Git repository.


basicAuth?๐Ÿ”น

Type: BasicAuth (optional, default: no password protection)

The Basic Auth configuration.

Use this to set password protection at an app level to all your branches.


buildSpec?๐Ÿ”น

Type: BuildSpec (optional, default: no build spec)

BuildSpec for the application.

Alternatively, add a amplify.yml file to the repository.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html


customResponseHeaders?๐Ÿ”น

Type: CustomResponseHeader[] (optional, default: no custom response headers)

The custom HTTP response headers for an Amplify app.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/custom-headers.html


customRules?๐Ÿ”น

Type: CustomRule[] (optional, default: no custom rewrite/redirect rules)

Custom rewrite/redirect rules for the application.


description?๐Ÿ”น

Type: string (optional, default: no description)

A description for the application.


environmentVariables?๐Ÿ”น

Type: { [string]: string } (optional, default: no environment variables)

Environment variables for the application.

All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information.


role?๐Ÿ”น

Type: IRole (optional, default: a new role is created)

The IAM service role to associate with the application.

The App implements IGrantable.


sourceCodeProvider?๐Ÿ”น

Type: ISourceCodeProvider (optional, default: not connected to a source code provider)

The source code provider for this application.

Properties

NameTypeDescription
appId๐Ÿ”นstringThe application id.
appName๐Ÿ”นstringThe name of the application.
arn๐Ÿ”นstringThe ARN of the application.
defaultDomain๐Ÿ”นstringThe default domain of the application.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
grantPrincipal๐Ÿ”นIPrincipalThe principal to grant permissions to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.

appId๐Ÿ”น

Type: string

The application id.


appName๐Ÿ”น

Type: string

The name of the application.


arn๐Ÿ”น

Type: string

The ARN of the application.


defaultDomain๐Ÿ”น

Type: string

The default domain of the application.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal to grant permissions to.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAutoBranchEnvironment(name, value)๐Ÿ”นAdds an environment variable to the auto created branch.
addBranch(id, options?)๐Ÿ”นAdds a branch to this application.
addCustomRule(rule)๐Ÿ”นAdds a custom rewrite/redirect rule to this application.
addDomain(id, options?)๐Ÿ”นAdds a domain to this application.
addEnvironment(name, value)๐Ÿ”นAdds an environment variable to this application.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromAppId(scope, id, appId)๐Ÿ”นImport an existing application.

addAutoBranchEnvironment(name, value)๐Ÿ”น

public addAutoBranchEnvironment(name: string, value: string): App

Parameters

  • name string
  • value string

Returns

  • App

Adds an environment variable to the auto created branch.

All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information.


addBranch(id, options?)๐Ÿ”น

public addBranch(id: string, options?: BranchOptions): Branch

Parameters

  • id string
  • options BranchOptions

Returns

  • Branch

Adds a branch to this application.


addCustomRule(rule)๐Ÿ”น

public addCustomRule(rule: CustomRule): App

Parameters

  • rule CustomRule

Returns

  • App

Adds a custom rewrite/redirect rule to this application.


addDomain(id, options?)๐Ÿ”น

public addDomain(id: string, options?: DomainOptions): Domain

Parameters

  • id string
  • options DomainOptions

Returns

  • Domain

Adds a domain to this application.


addEnvironment(name, value)๐Ÿ”น

public addEnvironment(name: string, value: string): App

Parameters

  • name string
  • value string

Returns

  • App

Adds an environment variable to this application.

All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromAppId(scope, id, appId)๐Ÿ”น

public static fromAppId(scope: Construct, id: string, appId: string): IApp

Parameters

  • scope Construct
  • id string
  • appId string

Returns

  • IApp

Import an existing application.