This sample contains an AWS AppConfig Extension which checks your AppConfig configuration profile data for PII (via Amazon Comprehend). This can help prevent accidental disclosure of private information to your application, which could be caused by (for example) copy and pasting the wrong values in to your configuration data.
The Extension runs on the PRE_START_DEPLOYMENT hook, and the
content of the configuration to be deployed is passed to the
DetectPIIEntities
API. If any entities are reported, the deployment is
blocked. For more information on the entities detected, see the Amazon Comprehend documentation.
The Lambda function code for the extension is in lambda/index.py
; the CDK
stack is here to build and deploy it with the correct IAM permissions, and
create an AppConfig Extension entry.
Please see the AWS AppConfig documentation for details on configuring the service.
Ensure you have up-to-date Python and AWS CDK v2 installed.
You will need Docker or finch installed and running for CDK to build the Lambda function.
- Clone this repo
- In the cloned repo, create a Python virtual environment:
python -m venv .venv
- Activate your virtual environment:
source .venv/bin/activate
- Install the Python dependencies:
pip install -r requirements.txt
- Ensure you have suitable AWS credentials configured in your environment
If you haven't yet bootstrapped the CDK in your environment, you will need to
run cdk bootstrap
.
- Deploy this CDK app:
cdk deploy
. You only need to deploy it once per AWS Account/Region. - Navigate to the AppConfig console, then choose Extensions
- Choose the PII-Comprehend extension, then choose Add to resource
- Choose the Resource Type to associate the Extension with
- Choose Create Association to Resource
- Navigate to the AppConfig console, then choose Extensions
- Choose the PII-Comprehend extension
- For each entry under Associated resources, choose the radio button then choose Remove association, then choose Delete
- Once you have removed all the Associated resources, you can
cdk destroy
the app
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.