Skip to content

Latest commit

 

History

History
1157 lines (728 loc) · 43.9 KB

File metadata and controls

1157 lines (728 loc) · 43.9 KB

API Reference

Constructs

AmplifyExportedBackend

  • Used to include the backend generated by running amplify export --out <path> into the cdk app.

Initializers

import { AmplifyExportedBackend } from '@aws-amplify/cdk-exported-backend'

new AmplifyExportedBackend(scope: Construct, id: string, props: AmplifyExportedBackendProps)
Name Type Description
scope constructs.Construct The parent construct of this template.
id string The ID of this construct.
props AmplifyExportedBackendProps Initialization properties.

scopeRequired
  • Type: constructs.Construct

The parent construct of this template.


idRequired
  • Type: string

The ID of this construct.


propsRequired

Initialization properties.


Methods

Name Description
toString Returns a string representation of this construct.
with Applies one or more mixins to this construct.
apiRestNestedStack Use this to get rest api stack from the backend.
authNestedStack Method to get the auth stack.
graphqlNestedStacks Use this to get the api graphql stack from the backend.
lambdaFunctionNestedStackByName Use this to get a specific lambda function from the backend.
lambdaFunctionNestedStacks Use this to get all the lambda functions from the backend.
nestedStackByCategortService No description.
nestedStacksByCategory Returns the stacks defined in the backend.

toString
public toString(): string

Returns a string representation of this construct.

with
public with(mixins: ...IMixin[]): IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

mixinsRequired
  • Type: ...constructs.IMixin[]

The mixins to apply.


apiRestNestedStack
public apiRestNestedStack(resourceName: string): APIRestIncludedStack

Use this to get rest api stack from the backend.

resourceNameRequired
  • Type: string

authNestedStack
public authNestedStack(): AuthIncludedNestedStack

Method to get the auth stack.

graphqlNestedStacks
public graphqlNestedStacks(): APIGraphQLIncludedNestedStack

Use this to get the api graphql stack from the backend.

lambdaFunctionNestedStackByName
public lambdaFunctionNestedStackByName(functionName: string): LambdaFunctionIncludedNestedStack

Use this to get a specific lambda function from the backend.

functionNameRequired
  • Type: string

the function name to get from the nested stack.


lambdaFunctionNestedStacks
public lambdaFunctionNestedStacks(): LambdaFunctionIncludedNestedStack[]

Use this to get all the lambda functions from the backend.

nestedStackByCategortService
public nestedStackByCategortService(category: string, service: string): IncludedNestedStack[]
categoryRequired
  • Type: string

serviceRequired
  • Type: string

nestedStacksByCategory
public nestedStacksByCategory(category: string, resourceName?: string): IncludedNestedStack[]

Returns the stacks defined in the backend.

categoryRequired
  • Type: string

Categories defined in Amplify CLI like function, api, auth etc.


resourceNameOptional
  • Type: string

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { AmplifyExportedBackend } from '@aws-amplify/cdk-exported-backend'

AmplifyExportedBackend.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will 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 constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
cfnInclude aws-cdk-lib.cloudformation_include.CfnInclude cfnInclude of the Amplify backend.
rootStack aws-cdk-lib.Stack The root stack created.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


cfnIncludeRequired
public readonly cfnInclude: CfnInclude;
  • Type: aws-cdk-lib.cloudformation_include.CfnInclude

cfnInclude of the Amplify backend.


rootStackRequired
public readonly rootStack: Stack;
  • Type: aws-cdk-lib.Stack

The root stack created.


Structs

AmplifyExportedBackendProps

Initializer

import { AmplifyExportedBackendProps } from '@aws-amplify/cdk-exported-backend'

const amplifyExportedBackendProps: AmplifyExportedBackendProps = { ... }

Properties

Name Type Description
analyticsReporting boolean Include runtime versioning information in this Stack.
crossRegionReferences boolean Enable this flag to allow native cross region stack references.
description string A description of the stack.
env aws-cdk-lib.Environment The AWS environment (account/region) where this stack will be deployed.
notificationArns string[] SNS Topic ARNs that will receive stack events.
permissionsBoundary aws-cdk-lib.PermissionsBoundary Options for applying a permissions boundary to all IAM Roles and Users created within this Stage.
propertyInjectors aws-cdk-lib.IPropertyInjector[] A list of IPropertyInjector attached to this Stack.
stackName string Name to deploy the stack with.
suppressTemplateIndentation boolean Enable this flag to suppress indentation in generated CloudFormation templates.
synthesizer aws-cdk-lib.IStackSynthesizer Synthesis method to use while deploying this stack.
tags {[ key: string ]: string} Tags that will be applied to the Stack.
terminationProtection boolean Whether to enable termination protection for this stack.
amplifyEnvironment string The Amplify CLI environment deploy to The amplify backend requires a stage to deploy.
path string The path to the exported folder that contains the artifacts for the Amplify CLI backend ex: ./amplify-synth-out/.

analyticsReportingOptional
public readonly analyticsReporting: boolean;
  • Type: boolean
  • Default: analyticsReporting setting of containing App, or value of 'aws:cdk:version-reporting' context key

Include runtime versioning information in this Stack.


crossRegionReferencesOptional
public readonly crossRegionReferences: boolean;
  • Type: boolean
  • Default: false

Enable this flag to allow native cross region stack references.

Enabling this will create a CloudFormation custom resource in both the producing stack and consuming stack in order to perform the export/import

This feature is currently experimental


descriptionOptional
public readonly description: string;
  • Type: string
  • Default: No description.

A description of the stack.


envOptional
public readonly env: Environment;
  • Type: aws-cdk-lib.Environment
  • Default: The environment of the containing Stage if available, otherwise create the stack will be environment-agnostic.

The AWS environment (account/region) where this stack will be deployed.

Set the region/account fields of env to either a concrete value to select the indicated environment (recommended for production stacks), or to the values of environment variables CDK_DEFAULT_REGION/CDK_DEFAULT_ACCOUNT to let the target environment depend on the AWS credentials/configuration that the CDK CLI is executed under (recommended for development stacks).

If the Stack is instantiated inside a Stage, any undefined region/account fields from env will default to the same field on the encompassing Stage, if configured there.

If either region or account are not set nor inherited from Stage, the Stack will be considered "environment-agnostic"". Environment-agnostic stacks can be deployed to any environment but may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups such as ec2.Vpc.fromLookup and will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements.


Example

// Use a concrete account and region to deploy this stack to:
// `.account` and `.region` will simply return these values.
new Stack(app, 'Stack1', {
  env: {
    account: '123456789012',
    region: 'us-east-1'
  },
});

// Use the CLI's current credentials to determine the target environment:
// `.account` and `.region` will reflect the account+region the CLI
// is configured to use (based on the user CLI credentials)
new Stack(app, 'Stack2', {
  env: {
    account: process.env.CDK_DEFAULT_ACCOUNT,
    region: process.env.CDK_DEFAULT_REGION
  },
});

// Define multiple stacks stage associated with an environment
const myStage = new Stage(app, 'MyStage', {
  env: {
    account: '123456789012',
    region: 'us-east-1'
  }
});

// both of these stacks will use the stage's account/region:
// `.account` and `.region` will resolve to the concrete values as above
new MyStack(myStage, 'Stack1');
new YourStack(myStage, 'Stack2');

// Define an environment-agnostic stack:
// `.account` and `.region` will resolve to `{ "Ref": "AWS::AccountId" }` and `{ "Ref": "AWS::Region" }` respectively.
// which will only resolve to actual values by CloudFormation during deployment.
new MyStack(app, 'Stack1');
notificationArnsOptional
public readonly notificationArns: string[];
  • Type: string[]
  • Default: no notification arns.

SNS Topic ARNs that will receive stack events.


permissionsBoundaryOptional
public readonly permissionsBoundary: PermissionsBoundary;
  • Type: aws-cdk-lib.PermissionsBoundary
  • Default: no permissions boundary is applied

Options for applying a permissions boundary to all IAM Roles and Users created within this Stage.


propertyInjectorsOptional
public readonly propertyInjectors: IPropertyInjector[];
  • Type: aws-cdk-lib.IPropertyInjector[]
  • Default: no PropertyInjectors

A list of IPropertyInjector attached to this Stack.


stackNameOptional
public readonly stackName: string;
  • Type: string
  • Default: Derived from construct path.

Name to deploy the stack with.


suppressTemplateIndentationOptional
public readonly suppressTemplateIndentation: boolean;
  • Type: boolean
  • Default: the value of @aws-cdk/core:suppressTemplateIndentation, or false if that is not set.

Enable this flag to suppress indentation in generated CloudFormation templates.

If not specified, the value of the @aws-cdk/core:suppressTemplateIndentation context key will be used. If that is not specified, then the default value false will be used.


synthesizerOptional
public readonly synthesizer: IStackSynthesizer;
  • Type: aws-cdk-lib.IStackSynthesizer
  • Default: The synthesizer specified on App, or DefaultStackSynthesizer otherwise.

Synthesis method to use while deploying this stack.

The Stack Synthesizer controls aspects of synthesis and deployment, like how assets are referenced and what IAM roles to use. For more information, see the README of the main CDK package.

If not specified, the defaultStackSynthesizer from App will be used. If that is not specified, DefaultStackSynthesizer is used if @aws-cdk/core:newStyleStackSynthesis is set to true or the CDK major version is v2. In CDK v1 LegacyStackSynthesizer is the default if no other synthesizer is specified.


tagsOptional
public readonly tags: {[ key: string ]: string};
  • Type: {[ key: string ]: string}
  • Default: {}

Tags that will be applied to the Stack.

These tags are applied to the CloudFormation Stack itself. They will not appear in the CloudFormation template.

However, at deployment time, CloudFormation will apply these tags to all resources in the stack that support tagging. You will not be able to exempt resources from tagging (using the excludeResourceTypes property of Tags.of(...).add()) for tags applied in this way.


terminationProtectionOptional
public readonly terminationProtection: boolean;
  • Type: boolean
  • Default: false

Whether to enable termination protection for this stack.


amplifyEnvironmentRequired
public readonly amplifyEnvironment: string;
  • Type: string
  • Default: is 'dev'

The Amplify CLI environment deploy to The amplify backend requires a stage to deploy.


pathRequired
public readonly path: string;
  • Type: string

The path to the exported folder that contains the artifacts for the Amplify CLI backend ex: ./amplify-synth-out/.


CategoryStackMapping

Initializer

import { CategoryStackMapping } from '@aws-amplify/cdk-exported-backend'

const categoryStackMapping: CategoryStackMapping = { ... }

Properties

Name Type Description
category string No description.
resourceName string No description.
service string No description.

categoryRequired
public readonly category: string;
  • Type: string

resourceNameRequired
public readonly resourceName: string;
  • Type: string

serviceRequired
public readonly service: string;
  • Type: string

ExportManifest

Initializer

import { ExportManifest } from '@aws-amplify/cdk-exported-backend'

const exportManifest: ExportManifest = { ... }

Properties

Name Type Description
props aws-cdk-lib.cloudformation_include.CfnIncludeProps No description.
stackName string No description.

propsRequired
public readonly props: CfnIncludeProps;
  • Type: aws-cdk-lib.cloudformation_include.CfnIncludeProps

stackNameRequired
public readonly stackName: string;
  • Type: string

ExportTag

Initializer

import { ExportTag } from '@aws-amplify/cdk-exported-backend'

const exportTag: ExportTag = { ... }

Properties

Name Type Description
key string No description.
value string No description.

keyRequired
public readonly key: string;
  • Type: string

valueRequired
public readonly value: string;
  • Type: string

ProviderCredential

Initializer

import { ProviderCredential } from '@aws-amplify/cdk-exported-backend'

const providerCredential: ProviderCredential = { ... }

Properties

Name Type Description
clientId string No description.
clientSecret string No description.
providerName string No description.

clientIdRequired
public readonly clientId: string;
  • Type: string

clientSecretRequired
public readonly clientSecret: string;
  • Type: string

providerNameRequired
public readonly providerName: string;
  • Type: string

Classes

APIGraphQLIncludedNestedStack

Initializers

import { APIGraphQLIncludedNestedStack } from '@aws-amplify/cdk-exported-backend'

new APIGraphQLIncludedNestedStack(includedStack: IncludedNestedStack)
Name Type Description
includedStack aws-cdk-lib.cloudformation_include.IncludedNestedStack No description.

includedStackRequired
  • Type: aws-cdk-lib.cloudformation_include.IncludedNestedStack

Methods

Name Description
appSyncAPIKey No description.
getResourceConstruct No description.
graphQLAPI No description.
graphQLSchema No description.
modelNestedStack No description.

appSyncAPIKey
public appSyncAPIKey(): CfnApiKey
getResourceConstruct
public getResourceConstruct(logicalId: string): any
logicalIdRequired
  • Type: string

graphQLAPI
public graphQLAPI(): CfnGraphQLApi
graphQLSchema
public graphQLSchema(): CfnGraphQLSchema
modelNestedStack
public modelNestedStack(tableName: string): IncludedNestedStack
tableNameRequired
  • Type: string

is the model name in your Graph QL API.


Properties

Name Type Description
includedTemplate aws-cdk-lib.cloudformation_include.CfnInclude No description.
stack aws-cdk-lib.NestedStack No description.

includedTemplateRequired
public readonly includedTemplate: CfnInclude;
  • Type: aws-cdk-lib.cloudformation_include.CfnInclude

stackRequired
public readonly stack: NestedStack;
  • Type: aws-cdk-lib.NestedStack

APIRestIncludedStack

Initializers

import { APIRestIncludedStack } from '@aws-amplify/cdk-exported-backend'

new APIRestIncludedStack(includedStack: IncludedNestedStack, resourceName: string)
Name Type Description
includedStack aws-cdk-lib.cloudformation_include.IncludedNestedStack No description.
resourceName string No description.

includedStackRequired
  • Type: aws-cdk-lib.cloudformation_include.IncludedNestedStack

resourceNameRequired
  • Type: string

Methods

Name Description
apiDeployment Gets the Deployment of the Rest API.
getResourceConstruct No description.
restAPI Gets the RestApi of the API stack.

apiDeployment
public apiDeployment(): CfnDeployment

Gets the Deployment of the Rest API.

getResourceConstruct
public getResourceConstruct(logicalId: string): any
logicalIdRequired
  • Type: string

restAPI
public restAPI(): CfnRestApi

Gets the RestApi of the API stack.

Properties

Name Type Description
includedTemplate aws-cdk-lib.cloudformation_include.CfnInclude No description.
resourceName string No description.
stack aws-cdk-lib.NestedStack No description.

includedTemplateRequired
public readonly includedTemplate: CfnInclude;
  • Type: aws-cdk-lib.cloudformation_include.CfnInclude

resourceNameRequired
public readonly resourceName: string;
  • Type: string

stackRequired
public readonly stack: NestedStack;
  • Type: aws-cdk-lib.NestedStack

AuthIncludedNestedStack

Initializers

import { AuthIncludedNestedStack } from '@aws-amplify/cdk-exported-backend'

new AuthIncludedNestedStack(includedStack: IncludedNestedStack)
Name Type Description
includedStack aws-cdk-lib.cloudformation_include.IncludedNestedStack No description.

includedStackRequired
  • Type: aws-cdk-lib.cloudformation_include.IncludedNestedStack

Methods

Name Description
getResourceConstruct No description.
hostedUiProviderCredentials No description.
identityPool No description.
userPool No description.

getResourceConstruct
public getResourceConstruct(logicalId: string): any
logicalIdRequired
  • Type: string

hostedUiProviderCredentials
public hostedUiProviderCredentials(credentials: ProviderCredential[]): void
credentialsRequired

identityPool
public identityPool(): CfnIdentityPool
userPool
public userPool(): CfnUserPool

Properties

Name Type Description
includedTemplate aws-cdk-lib.cloudformation_include.CfnInclude No description.
stack aws-cdk-lib.NestedStack No description.

includedTemplateRequired
public readonly includedTemplate: CfnInclude;
  • Type: aws-cdk-lib.cloudformation_include.CfnInclude

stackRequired
public readonly stack: NestedStack;
  • Type: aws-cdk-lib.NestedStack

LambdaFunctionIncludedNestedStack

Initializers

import { LambdaFunctionIncludedNestedStack } from '@aws-amplify/cdk-exported-backend'

new LambdaFunctionIncludedNestedStack(includedStack: IncludedNestedStack)
Name Type Description
includedStack aws-cdk-lib.cloudformation_include.IncludedNestedStack No description.

includedStackRequired
  • Type: aws-cdk-lib.cloudformation_include.IncludedNestedStack

Methods

Name Description
getResourceConstruct No description.
lambdaFunction No description.

getResourceConstruct
public getResourceConstruct(logicalId: string): any
logicalIdRequired
  • Type: string

lambdaFunction
public lambdaFunction(): CfnFunction

Properties

Name Type Description
includedTemplate aws-cdk-lib.cloudformation_include.CfnInclude No description.
stack aws-cdk-lib.NestedStack No description.

includedTemplateRequired
public readonly includedTemplate: CfnInclude;
  • Type: aws-cdk-lib.cloudformation_include.CfnInclude

stackRequired
public readonly stack: NestedStack;
  • Type: aws-cdk-lib.NestedStack