App
- class aws_cdk.aws_amplify_alpha.App(scope, id, *, app_name=None, auto_branch_creation=None, auto_branch_deletion=None, basic_auth=None, build_compute_type=None, build_spec=None, cache_config_type=None, compute_role=None, custom_response_headers=None, custom_rules=None, description=None, environment_variables=None, platform=None, role=None, source_code_provider=None)
- Bases: - Resource- (experimental) An Amplify Console application. - Stability:
- experimental 
- ExampleMetadata:
- infused 
 - Example: - amplify_app = amplify.App(self, "MyApp", source_code_provider=amplify.GitHubSourceCodeProvider( owner="<user>", repository="<repo>", oauth_token=SecretValue.secrets_manager("my-github-token") ), auto_branch_creation=amplify.AutoBranchCreation( # Automatically connect branches that match a pattern set patterns=["feature/*", "test/*"]), auto_branch_deletion=True ) - Parameters:
- scope ( - Construct)
- id ( - str)
- app_name ( - Optional[- str]) – (experimental) The name for the application. Default: - a CDK generated name
- auto_branch_creation ( - Union[- AutoBranchCreation,- Dict[- str,- Any],- None]) – (experimental) The auto branch creation configuration. Use this to automatically create branches that match a certain pattern. Default: - no auto branch creation
- auto_branch_deletion ( - Optional[- bool]) – (experimental) Automatically disconnect a branch in the Amplify Console when you delete a branch from your Git repository. Default: false
- basic_auth ( - Optional[- BasicAuth]) – (experimental) The Basic Auth configuration. Use this to set password protection at an app level to all your branches. Default: - no password protection
- build_compute_type ( - Optional[- BuildComputeType]) – (experimental) Specifies the size of the build instance. Default: undefined - Amplify default setting is- BuildComputeType.STANDARD_8GB.
- build_spec ( - Optional[- BuildSpec]) – (experimental) BuildSpec for the application. Alternatively, add a- amplify.ymlfile to the repository. Default: - no build spec
- cache_config_type ( - Optional[- CacheConfigType]) – (experimental) The type of cache configuration to use for an Amplify app. Default: CacheConfigType.AMPLIFY_MANAGED
- compute_role ( - Optional[- IRole]) – (experimental) The IAM role for an SSR app. The Compute role allows the Amplify Hosting compute service to securely access specific AWS resources based on the role’s permissions. Default: undefined - a new role is created when- platformis- Platform.WEB_COMPUTEor- Platform.WEB_DYNAMIC, otherwise no compute role
- custom_response_headers ( - Optional[- Sequence[- Union[- CustomResponseHeader,- Dict[- str,- Any]]]]) – (experimental) The custom HTTP response headers for an Amplify app. Default: - no custom response headers
- custom_rules ( - Optional[- Sequence[- CustomRule]]) – (experimental) Custom rewrite/redirect rules for the application. Default: - no custom rewrite/redirect rules
- description ( - Optional[- str]) – (experimental) A description for the application. Default: - no description
- environment_variables ( - Optional[- Mapping[- str,- str]]) – (experimental) 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. Default: - no environment variables
- platform ( - Optional[- Platform]) – (experimental) Indicates the hosting platform to use. Set to WEB for static site generated (SSG) apps (i.e. a Create React App or Gatsby) and WEB_COMPUTE for server side rendered (SSR) apps (i.e. NextJS). Default: Platform.WEB
- role ( - Optional[- IRole]) – (experimental) The IAM service role to associate with the application. The App implements IGrantable. Default: - a new role is created
- source_code_provider ( - Optional[- ISourceCodeProvider]) – (experimental) The source code provider for this application. Default: - not connected to a source code provider
 
- Stability:
- experimental 
 - Methods - add_auto_branch_environment(name, value)
- (experimental) 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. - Parameters:
- name ( - str)
- value ( - str)
 
- Stability:
- experimental 
- Return type:
 
 - add_branch(id, *, asset=None, auto_build=None, basic_auth=None, branch_name=None, build_spec=None, compute_role=None, description=None, environment_variables=None, performance_mode=None, pull_request_environment_name=None, pull_request_preview=None, skew_protection=None, stage=None)
- (experimental) Adds a branch to this application. - Parameters:
- id ( - str)
- asset ( - Optional[- Asset]) – (experimental) Asset for deployment. The Amplify app must not have a sourceCodeProvider configured as this resource uses Amplify’s startDeployment API to initiate and deploy a S3 asset onto the App. Default: - no asset
- auto_build ( - Optional[- bool]) – (experimental) Whether to enable auto building for the branch. Default: true
- basic_auth ( - Optional[- BasicAuth]) – (experimental) The Basic Auth configuration. Use this to set password protection for the branch Default: - no password protection
- branch_name ( - Optional[- str]) – (experimental) The name of the branch. Default: - the construct’s id
- build_spec ( - Optional[- BuildSpec]) – (experimental) BuildSpec for the branch. Default: - no build spec
- compute_role ( - Optional[- IRole]) – (experimental) The IAM role to assign to a branch of an SSR app. The SSR Compute role allows the Amplify Hosting compute service to securely access specific AWS resources based on the role’s permissions. This role overrides the app-level compute role. Default: undefined - No specific role for the branch. If the app has a compute role, it will be inherited.
- description ( - Optional[- str]) – (experimental) A description for the branch. Default: - no description
- environment_variables ( - Optional[- Mapping[- str,- str]]) – (experimental) Environment variables for the branch. All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information. Default: - application environment variables
- performance_mode ( - Optional[- bool]) – (experimental) 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. Default: false
- pull_request_environment_name ( - Optional[- str]) – (experimental) The dedicated backend environment for the pull request previews. Default: - automatically provision a temporary backend
- pull_request_preview ( - Optional[- bool]) – (experimental) Whether to enable pull request preview for the branch. Default: true
- skew_protection ( - Optional[- bool]) – (experimental) Specifies whether the skew protection feature is enabled for the branch. 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. Default: None - Default setting is no skew protection.
- stage ( - Optional[- str]) – (experimental) Stage for the branch. Default: - no stage
 
- Stability:
- experimental 
- Return type:
 
 - add_custom_rule(rule)
- (experimental) Adds a custom rewrite/redirect rule to this application. - Parameters:
- rule ( - CustomRule)
- Stability:
- experimental 
- Return type:
 
 - add_domain(id, *, auto_subdomain_creation_patterns=None, custom_certificate=None, domain_name=None, enable_auto_subdomain=None, sub_domains=None)
- (experimental) Adds a domain to this application. - Parameters:
- id ( - str)
- auto_subdomain_creation_patterns ( - Optional[- Sequence[- str]]) – (experimental) Branches which should automatically create subdomains. Default: - all repository branches [‘*’, ‘pr*’]
- custom_certificate ( - Optional[- ICertificate]) – (experimental) The type of SSL/TLS certificate to use for your custom domain. Default: - Amplify uses the default certificate that it provisions and manages for you
- domain_name ( - Optional[- str]) – (experimental) The name of the domain. Default: - the construct’s id
- enable_auto_subdomain ( - Optional[- bool]) – (experimental) Automatically create subdomains for connected branches. Default: false
- sub_domains ( - Optional[- Sequence[- Union[- SubDomain,- Dict[- str,- Any]]]]) – (experimental) Subdomains. Default: - use- addSubDomain()to add subdomains
 
- Stability:
- experimental 
- Return type:
 
 - add_environment(name, value)
- (experimental) 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. - Parameters:
- name ( - str)
- value ( - str)
 
- Stability:
- experimental 
- Return type:
 
 - apply_removal_policy(policy)
- 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).- Parameters:
- policy ( - RemovalPolicy)
- Return type:
- None
 
 - to_string()
- Returns a string representation of this construct. - Return type:
- str
 
 - Attributes - PROPERTY_INJECTION_ID = '@aws-cdk.aws-amplify-alpha.App'
 - app_id
- (experimental) The application id. - Stability:
- experimental 
 
 - app_name
- (experimental) The name of the application. - Stability:
- experimental 
- Attribute:
- true 
 
 - arn
- (experimental) The ARN of the application. - Stability:
- experimental 
- Attribute:
- true 
 
 - compute_role
- (experimental) The IAM role for an SSR app. - Stability:
- experimental 
 
 - default_domain
- (experimental) The default domain of the application. - Stability:
- experimental 
- Attribute:
- true 
 
 - env
- 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. 
 - grant_principal
- (experimental) The principal to grant permissions to. - Stability:
- experimental 
 
 - node
- The tree node. 
 - platform
- (experimental) The platform of the app. - Stability:
- experimental 
 
 - stack
- The stack in which this resource is defined. 
 - Static Methods - classmethod from_app_id(scope, id, app_id)
- (experimental) Import an existing application. 
 - classmethod is_construct(x)
- Checks if - xis a construct.- Use this method instead of - instanceofto properly detect- Constructinstances, even when the construct library is symlinked.- Explanation: in JavaScript, multiple copies of the - constructslibrary on disk are seen as independent, completely different libraries. As a consequence, the class- Constructin each copy of the- constructslibrary is seen as a different class, and an instance of one class will not test as- instanceofthe other class.- npm installwill not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the- constructslibrary can be accidentally installed, and- instanceofwill behave unpredictably. It is safest to avoid using- instanceof, and using this type-testing method instead.- Parameters:
- x ( - Any) – Any object.
- Return type:
- bool
- Returns:
- true if - xis an object created from a class which extends- Construct.
 
 - classmethod is_owned_resource(construct)
- Returns true if the construct was created by CDK, and false otherwise. - Parameters:
- construct ( - IConstruct)
- Return type:
- bool
 
 - classmethod is_resource(construct)
- Check whether the given construct is a Resource. - Parameters:
- construct ( - IConstruct)
- Return type:
- bool