@stellarlibs/nx-cdk v1.0.91
Nx Aws Cdk Documentation
AWS Cloud Development Kit (CDK) applications within Nx workspaces.
Table of Contents
- Generate Application
- Generate Library
- Remove Application
- Environment Bootstrap
- Synthesize Application
- Deploy Application/Stack
- Destroy Application/Stack
Installation
The @stellarlibs/nx-cdk package can be installed via npm or yarn. It provides tools for managing AWS CDK applications. To install, use the following command:
npm i @stellarlibs/nx-cdkStarter
basic commands
nx g @stellarlibs/nx-cdk:app <AppName>nx bootstrap <AppName>nx deploy <AppName>1. Generate Application
To generate a new application, use the following command. This command sets up a new AWS CDK application with optional configurations for testing and linting.
nx g @stellarlibs/nx-cdk:app <APP_NAME>
[--tag <String>]
[--directory <String>]
[--testRunner <jest | none>]Options:
--tag(optional): Tags to categorize your applications. You can pass multiple --tag arguments.--testRunner(optional): Specifies the testing library to use. Jest | None.--directory(optional): Specifies the directory where the application will be created.
Example:
nx g @stellarlibs/nx-cdk:app myapp --tag experimental --tag infrastructure --directory apps2. Generate Library
To generate a new library, use the following command. This command sets up a new AWS CDK library with optional configurations for testing and linting.
nx g @stellarlibs/nx-cdk:lib <APP_NAME>
[--tag <String>]
[--directory <String>]
[--testRunner <jest | none>]Options:
--tag(optional): Tags to categorize your applications. You can pass multiple --tag arguments.--testRunner(optional): Specifies the testing library to use. Jest | None.--directory(optional): Specifies the directory where the application will be created.
Example:
nx g @stellarlibs/nx-cdk:lib myapp --tag experimental --tag infrastructure --directory apps3. Remove Application
To remove an existing application, use the following command:
nx g @stellarlibs/nx-cdk:remove <APP_NAME>4. Bootstrap
Before deploying the application, it's necessary to bootstrap the environment. This step prepares the AWS resources required for deployment.
| Check aws cdk documentation for more options
nx bootstrap <APP_NAME>
[--all <Boolean>]
[--qualifier <Bootstrap_Qualifier>]
[--bucketName <Bucket_Name>]
[--executionPolicy <Execution_Policy_ARN>]
[--terminationProtection]
[--kmsKeyId <Kms_Key_Id>]
[--trust <Trust_Options>]
...Options:
--profile(optional): Specifies the AWS profile for bootstrapping.--qualifier(optional): Specifies the bootstrap qualifier.--bucketName(optional): Specifies the bootstrap bucket name.--executionPolicy(optional): Specifies the execution policy ARN.--terminationProtection(optional): Protects against termination.--kmsKeyId(optional): Specifies the KMS key ID.--trust(optional): Specifies trust options.
5. Synth
The nx synth <APP_NAME> command is used to synthesize the application, which means it compiles your source code into a format that can be deployed to AWS.
nx synth <APP_NAME>
[--output <OUTPUT_DIRECTORY>]Options:
--output(optional): Specifies the directory for the synthesized output.
6. Deploy
To deploy the application/stack, execute:
nx deploy <Stack_Name>
[--stack <Stack_Name>]Options:
--stack(optional) <Stack_Name>: Specifies the stack name to deploy. You can pass multiple --stack arguments.
Example:
nx deploy --stack StackOne --stack StackTwo7. Destroy
To destroy the application/stack, execute:
nx destroy <Stack_Name>
[--stack <Stack_Name>]Options:
--stack(optional): Specifies the stack name to destroy. You can pass multiple --stack arguments.
Example:
nx destroy --stack StackOne --stack StackTwo2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago