AWS Solutions Constructs AWS Solutions AWS Solutions Constructs AWS Solutions

AWS Solutions Constructs: AWS Solutions Copyright © Web Services, Inc. and/or its affiliates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon. AWS Solutions Constructs AWS Solutions

Table of Contents

Overview ...... 1 What is AWS Solutions Constructs? ...... 1 Why use AWS Solutions Constructs? ...... 1 Getting Started ...... 2 Prerequisites ...... 2 Installing the AWS CDK ...... 2 Working with AWS Solutions Constructs ...... 2 Walkthrough - Part 1 ...... 3 Hello Constructs ...... 3 Creating the App Directory and Initializing the AWS CDK ...... 4 Update project base dependencies ...... 4 Lambda handler code ...... 6 Install the AWS CDK and AWS Solutions Constructs dependencies ...... 7 Add an Amazon API Gateway/AWS Lambda pattern to your stack ...... 8 cdk deploy ...... 12 Stack outputs ...... 12 Testing your app ...... 12 Walkthrough - Part 2 ...... 13 Hit Counter Lambda code ...... 13 Install the new dependencies ...... 15 Define the resources ...... 15 Review the changes ...... 24 cdk deploy ...... 25 Stack outputs ...... 25 Testing your app ...... 25 Sample Use Cases ...... 26 AWS Static S3 Website ...... 27 AWS Simple Serverless Image Handler ...... 27 AWS Serverless Web App ...... 27 AWS Restaurant Management Demo ...... 27 API Reference ...... 28 Modules ...... 28 Module Contents ...... 28 aws-apigateway-dynamodb ...... 28 Overview ...... 29 Initializer ...... 29 Pattern Construct Props ...... 29 Pattern Properties ...... 31 Default settings ...... 31 Architecture ...... 32 GitHub ...... 32 aws-apigateway-iot ...... 32 Overview ...... 33 Initializer ...... 33 Pattern Construct Props ...... 34 Pattern Properties ...... 34 Default settings ...... 35 Architecture ...... 36 Examples ...... 36 GitHub ...... 38 aws-apigateway-kinesisstreams ...... 38 Overview ...... 38 Initializer ...... 39 Pattern Construct Props ...... 39

iii AWS Solutions Constructs AWS Solutions

Pattern Properties ...... 40 Sample API Usage ...... 40 Default settings ...... 41 Architecture ...... 42 GitHub ...... 42 aws-apigateway-lambda ...... 43 Overview ...... 43 Initializer ...... 43 Pattern Construct Props ...... 44 Pattern Properties ...... 44 Default settings ...... 44 Architecture ...... 45 GitHub ...... 45 aws-apigateway-sagemakerendpoint ...... 46 Overview ...... 46 Initializer ...... 47 Pattern Construct Props ...... 47 Pattern Properties ...... 48 Sample API Usage ...... 40 Default settings ...... 48 Architecture ...... 49 GitHub ...... 49 aws-apigateway-sqs ...... 50 Overview ...... 50 Initializer ...... 50 Pattern Construct Props ...... 51 Pattern Properties ...... 52 Sample API Usage ...... 40 Default settings ...... 52 Architecture ...... 53 GitHub ...... 53 aws-cloudfront-apigateway ...... 54 Overview ...... 54 Initializer ...... 55 Pattern Construct Props ...... 55 Pattern Properties ...... 55 Default settings ...... 56 Architecture ...... 57 GitHub ...... 57 aws-cloudfront-apigateway-lambda ...... 57 Overview ...... 58 Initializer ...... 58 Pattern Construct Props ...... 59 Pattern Properties ...... 59 Default settings ...... 60 Architecture ...... 61 GitHub ...... 61 aws-cloudfront-mediastore ...... 61 Overview ...... 62 Initializer ...... 62 Pattern Construct Props ...... 62 Pattern Properties ...... 63 Default settings ...... 63 Architecture ...... 64 GitHub ...... 64 aws-cloudfront-s3 ...... 64 Overview ...... 65

iv AWS Solutions Constructs AWS Solutions

Initializer ...... 65 Pattern Construct Props ...... 65 Pattern Properties ...... 66 Default settings ...... 67 Architecture ..