Pip Potter 81d22bc742 Migrate AWS Gems to CDKv2 (#11675) | 1 year ago | |
---|---|---|
.. | ||
core | 1 year ago | |
example | 1 year ago | |
.gitignore | 1 year ago | |
README.md | 1 year ago | |
app.py | 1 year ago | |
architecture.png | 1 year ago | |
cdk.context.json | 1 year ago | |
cdk.json | 1 year ago | |
constants.py | 1 year ago | |
requirements.txt | 1 year ago |
This is a legacy CDK v1 application and is provided for backwards compatibility only.
The CDK has migrated to a new long term version CDK v2. See the CDK documentation for guidance of how to upgrade.
This is an optional CDK v1 application that provides two stacks:
The cdk.json
file tells the CDK Toolkit how to execute your app.
This project is set up like a standard Python project. The initialization
process also creates a virtualenv within this project, stored under the .env
directory. To create the virtualenv it assumes that there is a python3
(or python
for Windows) (Python 3.7+) executable in your path with access to the venv
package. If for any reason the automatic creation of the virtualenv fails,
you can create the virtualenv manually.
See https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html about for information about how to set up the prerequisites for CDK development.
To manually create a virtualenv on MacOS and Linux:
$ python -m venv .env
Once the virtualenv is created, you can use the following step to activate your virtualenv.
$ source .env/bin/activate
If you are a Windows platform, you would activate the virtualenv like this:
% .env\Scripts\activate.bat
Once the virtualenv is activated, you can install the required dependencies.
$ pip install -r requirements.txt
O3DE_AWS_DEPLOY_REGION
: The region to deploy the stacks into, will default to CDK_DEFAULT_REGIONO3DE_AWS_DEPLOY_ACCOUNT
: The account to deploy stacks into, will default to CDK_DEFAULT_ACCOUNTO3DE_AWS_PROJECT_NAME
: The name of the O3DE project stacks should be deployed for will default to AWS-PROJECTSee https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more information including how to pass parameters to use for environment variables.
At this point you can now synthesize the CloudFormation template for this code.
$ cdk synth
You may need todo a one time bootstrap, once per account, per region. The CDK application will prompt you on this.
To add additional dependencies, for example other CDK libraries, just add
them to your setup.py
file and rerun the pip install -r requirements.txt
command.
Optional features are activated by passing runtime context variables. To use multiple optional features together provide one key-value pair at a time:
cdk synth --context key1=value1 --context key2=value2 MyStack
The S3 bucket and Dynamodb created by the sample will be left behind as the CDK defaults to retaining such storage (both have default policies to retain resources on destroy). To delete the storage resources created when using CDK destroy, use the following commands to synthesize and destroy the CDK application.
cdk synth -c remove_all_storage_on_destroy=true --all
cdk deploy -c remove_all_storage_on_destroy=true --all
cdk destroy --all
Server access logging is enabled by default. To disable the feature, use the following commands to synthesize and deploy this CDK application.
$ cdk synth -c disable_access_log=true --all
$ cdk deploy -c disable_access_log=true --all
See https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html for more information about server access logging.
cdk ls
list all stacks in the appcdk synth
emits the synthesized CloudFormation templatecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk docs
open CDK documentationSee https://docs.aws.amazon.com/cdk/latest/guide/troubleshooting.html