This is a demo CDK application that's used to showcase some AWS services as well as a serverless processing workflow.
Things this demo shows
- AWS X-Ray
- S3 Event Notifications
- Amazon Rekognition
- boto3 clients vs. resources
- AWS CDK
- Have the CDK and the AWS SDK installed
- Configure your AWS credentials
- Clone the repo
- Nagivate to the repo
- Create a new virtual environment:
python3 -m venv .env
- Activate the virtual environment:
source .env\bin\activate
- Install the dependencies:
pip install -r requirements.txt
- Deploy the CDK app:
cdk deploy
- Deploy the app (see instructions above)
- Log in to the AWS Console and open the S3 Console
- Locate the Input bucket, the name will be something like
cdk-image-analyzer-inputbucket...
- Upload an image to the input bucket
- Navigate to DynamoDB and open the metadata table, it will be called something like
cdk-image-analyzer-metadatatable...
- You should see a single item in the table, click on it an show the labels that have been generated by Rekognition.
- Open the lambda function in the lambda console, it will be called something like
cdk-image-analyzer-processinglambda...
- Point out the event handler and explain, how data is extracted from the S3 event.
- Point out the different ways boto3 is used - Rekognition Client and Table Resource
- Note the import of the X-Ray SDK and the
patch_all()
method - Now upload another image and show the result in DynamoDB
- Open CloudWatch logs and take a look at the logs of the lambda function, point out the response from Rekognition
- After you've done 1) and 2), there should be some traces in AWS X-Ray
- Open the X-Ray service and click on the service map
- Wait a couple of seconds, it's not that fast on first load, maybe adjust the time range in the top right corner
Screenshots
- Open the CDK App and explain the separation of the business logic (
src
directory) from the infrastructure - Explain how the CDK makes permissions management a lot easier using
grants
and point out the additional IAM statement to allow access to Rekognition. - Run
cdk synth
to show the output that gets passed to CloudFormation - Change something on the infrastructure, e.g. add an S3 bucket and run
cdk diff
to show what changed - Run
cdk deploy
to update the architecture