Pip Potter 81d22bc742 Migrate AWS Gems to CDKv2 (#11675) | 1 年之前 | |
---|---|---|
.. | ||
aws_metrics | 1 年之前 | |
.gitignore | 1 年之前 | |
README.md | 1 年之前 | |
api_spec.json | 1 年之前 | |
app.py | 1 年之前 | |
architecture.png | 1 年之前 | |
cdk.json | 1 年之前 | |
requirements.txt | 1 年之前 |
This is the CDK v1 version of the sample project and is no longer receiving updates, please migrate to the CDKv2 version. CDK v1 entered maintenance on June 1, 2022, and will now receive only critical bug fixes and security patches. New features will be developed for CDK v2 exclusively.
This is an optional CDK application that provides a stack to build the metrics analytics pipeline. The deployed pipeline is simplified from the production ready AWS solution: https://docs.aws.amazon.com/solutions/latest/game-analytics-pipeline/welcome.html.
AWS services used by this CDK application may not be available in all regions.
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) 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. Please note that Python version 3.7.10 or higher is required to deploy this CDK application.
To manually create a virtualenv on macOS and Linux:
$ python -m venv .env
After the init process completes and 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
See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more information including how to pass parameters to use for environment variables.
An environment needs to be bootstrapped since this CDK application uses assets like a local directory that contains the handler code for the AWS Lambda functions.
Use the following CDK bootstrap command to bootstrap one or more AWS environments.
cdk bootstrap aws://ACCOUNT-NUMBER-1/REGION-1 aws://ACCOUNT-NUMBER-2/REGION-2 ...
See https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html for more information about bootstrapping.
At this point you can now synthesize the CloudFormation template for this code.
$ cdk synth
To add additional dependencies, for example other CDK libraries, just add
them to your requirements.txt
file and rerun the pip install -r requirements.txt
command.
To deploy the CDK application, use the following CLI command:
$ cdk deploy
You can optionally enable the batch processing feature by specifying the context variable like below:
$ cdk synth -c batch_processing=true
$ cdk deploy -c batch_processing=true
This will deploy the AWS resources required by the batch processing feature and bring additional cost.
To disable the feature and remove related AWS resources, you need to empty the deployed S3 bucket manually and run the normal CDK CLI commands for updating the CDK application:
$ cdk synth
$ cdk deploy
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