class App
Language | Type name |
---|---|
.NET | Amazon.CDK.App |
Go | github.com/aws/aws-cdk-go/awscdk/v2#App |
Java | software.amazon.awscdk.App |
Python | aws_cdk.App |
TypeScript (source) | aws-cdk-lib » App |
Implements
IConstruct
, IDependable
Extends
Stage
A construct which represents an entire CDK app. This construct is normally the root of the construct tree.
You would normally define an App
instance in your program's entrypoint,
then define constructs where the app is used as the parent scope.
After all the child constructs are defined within the app, you should call
app.synth()
which will emit a "cloud assembly" from this app into the
directory specified by outdir
. Cloud assemblies includes artifacts such as
CloudFormation templates and assets that are needed to deploy this app into
the AWS cloud.
See also: https://docs.aws.amazon.com/cdk/latest/guide/apps.html
Example
import * as cdk from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');
declare const bucket: s3.IBucket;
new dynamodb.Table(stack, 'Table', {
partitionKey: {
name: 'id',
type: dynamodb.AttributeType.STRING,
},
importSource: {
compressionType: dynamodb.InputCompressionType.GZIP,
inputFormat: dynamodb.InputFormat.csv({
delimiter: ',',
headerList: ['id', 'name'],
}),
bucket,
keyPrefix: 'prefix',
},
});
Initializer
new App(props?: AppProps)
Parameters
- props
App
— initialization properties.Props
Initializes a CDK application.
Properties
Name | Type | Description |
---|---|---|
artifact | string | Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string. |
asset | string | The cloud assembly asset output directory. |
node | Node | The tree node. |
outdir | string | The cloud assembly output directory. |
policy | IPolicy [] | Validation plugins to run during synthesis. |
stage | string | The name of the stage. |
account? | string | The default account for all resources defined within this stage. |
parent | Stage | The parent stage or undefined if this is the app. |
region? | string | The default region for all resources defined within this stage. |
artifactId
Type:
string
Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string.
Derived from the construct path.
assetOutdir
Type:
string
The cloud assembly asset output directory.
node
Type:
Node
The tree node.
outdir
Type:
string
The cloud assembly output directory.
policyValidationBeta1
Type:
IPolicy
[]
Validation plugins to run during synthesis.
If any plugin reports any violation, synthesis will be interrupted and the report displayed to the user.
stageName
Type:
string
The name of the stage.
Based on names of the parent stages separated by hypens.
account?
Type:
string
(optional)
The default account for all resources defined within this stage.
parentStage?
Type:
Stage
(optional)
The parent stage or undefined
if this is the app.
region?
Type:
string
(optional)
The default region for all resources defined within this stage.
Methods
Name | Description |
---|---|
synth(options?) | Synthesize this stage into a cloud assembly. |
to | Returns a string representation of this construct. |
static is | Checks if an object is an instance of the App class. |
synth(options?)
public synth(options?: StageSynthesisOptions): CloudAssembly
Parameters
- options
Stage
Synthesis Options
Returns
Synthesize this stage into a cloud assembly.
Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
App(obj)
static ispublic static isApp(obj: any): boolean
Parameters
- obj
any
— The object to evaluate.
Returns
boolean
Checks if an object is an instance of the App
class.