Each test suite has a separate CDK stack that can be used to set up the resources required to run that test suite.
Let's take the Pinpoint test suite as an example. To bring up the resources required (a Pinpoint application and a Cognito identity pool), follow the steps below.
Start from the CDK root, where this README.md
lives:
cd ~/amplify-ci-support/src/integ_test_resources/android/sdk/integration/cdk
Ensure that you have the CDK installed, if you haven't yet.
npm install -g aws-cdk
Ensure that you have credentials in your environment sufficient to run the CDK.
Install CDK dependencies from the root directory of the repo:
# Best to do this in a virtualenv
pip3 install -r requirements.txt
Export credentials and region:
Export appropriate role credentials to your local shell. Specifically, you must the following environment variables set:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
Also, you must set the AWS region to us-east-1:
export AWS_DEFAULT_REGION=us-east-1
Bootstrap the CDK If you have not yet, bootstrap the CDK:
cdk bootstrap
Note that these steps do each take a while.
list=$(cdk list 2>/dev/null | xargs)
cdk synth $list
cdk deploy $list
Generate a Pinpoint stack template at
./cdk.out/pinpoint.template.json
:
cdk synth 'pinpoint'
Use that template file to deploy a stack into your AWS account:
cdk deploy 'pinpoint'
Afterwards, to destroy the stack:
cdk destroy 'pinpoint'
The S3 suite requires use of some public buckets. As a result, you need to allow public buckets in your account, at all. (By default, AWS no long does, for security reasons.) This step only needs to be performed once, on the test account.