Package: aws-solutions-constructs.aws-apigateway-dynamodb
aws-apigateway-dynamodb module---All classes are under active development and subject to non-backward compatible changes or removal in any
future version. These are not subject to theSemantic Versioningmodel.
This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.Reference Documentation:https://docs.aws.amazon.com/solutions/latest/constructs/LanguagePackagePythonaws_solutions_constructs.aws_apigateway_dynamodbTypescript@aws-solutions-constructs/aws-apigateway-dynamodbJavasoftware.amazon.awsconstructs.services.apigatewaydynamodbOverviewThis AWS Solutions Construct implements an Amazon API Gateway REST API connected to Amazon DynamoDB table.Here is a minimal deployable pattern definition in:Typescriptimport{Construct}from'constructs';import{Stack,StackProps}from'aws-cdk-lib';import{ApiGatewayToDynamoDBProps,ApiGatewayToDynamoDB}from"@aws-solutions-constructs/aws-apigateway-dynamodb";newApiGatewayToDynamoDB(this,'test-api-gateway-dynamodb-default',{});Pythonfromaws_solutions_constructs.aws_apigateway_dynamodbimportApiGatewayToDynamoDBfromaws_cdkimportStackfromconstructsimportConstructApiGatewayToDynamoDB(self,'test-api-gateway-dynamodb-default')Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awsconstructs.services.apigatewaydynamodb.*;newApiGatewayToDynamoDB(this,"test-api-gateway-dynamodb-default",newApiGatewayToDynamoDBProps.Builder().build());Pattern Construct PropsNameTypeDescriptiondynamoTableProps?dynamodb.TablePropsOptional user provided props to override the default props for DynamoDB Table.existingTableObj?dynamodb.TableExisting instance of DynamoDB table object, providing both this anddynamoTablePropswill cause an error.apiGatewayProps?api.RestApiPropsOptional user-provided props to override the default props for the API Gateway.resourceName?stringOptional name of the resource on the API Gateway. Defaults to the table's partitionKeyNameallowCreateOperation?booleanWhether to deploy an API Gateway Method for POST HTTP operations on the DynamoDB table (i.e. dynamodb:PutItem).createRequestTemplate?stringAPI Gateway Request Template for the create method for the defaultapplication/jsoncontent-type. This property is required if theallowCreateOperationproperty is set to true.additionalCreateRequestTemplates?{ [contentType: string]: string; }Optional Create Request Templates for content-types other thanapplication/json. Use thecreateRequestTemplateproperty to set the request template for theapplication/jsoncontent-type. This property can only be specified if theallowCreateOperationproperty is set to true.createIntegrationResponses?api.IntegrationResponses[]Optional, custom API Gateway Integration Response for the create method. This property can only be specified if theallowCreateOperationproperty is set to true.allowReadOperation?booleanWhether to deploy an API Gateway Method for GET HTTP operations on DynamoDB table (i.e. dynamodb:Query).readRequestTemplate?stringAPI Gateway Request Template for the read method for the defaultapplication/jsoncontent-type. The default template only supports a partition key and not partition + sort keys.additionalReadRequestTemplates?{ [contentType: string]: string; }Optional Read Request Templates for content-types other thanapplication/json. Use thereadRequestTemplateproperty to set the request template for theapplication/jsoncontent-type.readIntegrationResponses?api.IntegrationResponses[]Optional, custom API Gateway Integration Response for the read method.allowUpdateOperation?booleanWhether to deploy API Gateway Method for PUT HTTP operations on DynamoDB table (i.e. dynamodb:UpdateItem).updateRequestTemplate?stringAPI Gateway Request Template for the update method. This property is required if theallowUpdateOperationproperty is set to true.additionalUpdateRequestTemplates?{ [contentType: string]: string; }Optional Update Request Templates for content-types other thanapplication/json. Use theupdateRequestTemplateproperty to set the request template for theapplication/jsoncontent-type. This property can only be specified if theallowUpdateOperationproperty is set to true.updateIntegrationResponses?api.IntegrationResponses[]Optional, custom API Gateway Integration Response for the update method. This property can only be specified if theallowUpdateOperationproperty is set to true.allowDeleteOperation?booleanWhether to deploy API Gateway Method for DELETE HTTP operations on DynamoDB table (i.e. dynamodb:DeleteItem).deleteRequestTemplate?stringAPI Gateway Request Template for the delete method for the defaultapplication/jsoncontent-type.additionalDeleteRequestTemplates?{ [contentType: string]: string; }Optional Delete request templates for content-types other thanapplication/json. Use thedeleteRequestTemplateproperty to set the request template for theapplication/jsoncontent-type. This property can only be specified if theallowDeleteOperationproperty is set to true.deleteIntegrationResponses?api.IntegrationResponses[]Optional, custom API Gateway Integration Response for the delete method. This property can only be specified if theallowDeleteOperationproperty is set to true.logGroupProps?logs.LogGroupPropsUser provided props to override the default props for for the CloudWatchLogs LogGroup.Pattern PropertiesNameTypeDescriptionapiGatewayapi.RestApiReturns an instance of the api.RestApi created by the construct.apiGatewayRoleiam.RoleReturns an instance of the iam.Role created by the construct for API Gateway.dynamoTabledynamodb.TableReturns an instance of dynamodb.Table created by the construct.apiGatewayCloudWatchRole?iam.RoleReturns an instance of the iam.Role created by the construct for API Gateway for CloudWatch access.apiGatewayLogGrouplogs.LogGroupReturns an instance of the LogGroup created by the construct for API Gateway access logging to CloudWatch.API Gateway Request/Response Template Properties OverviewThis construct allows you to implement four DynamoDB API operations, CREATE/READ/UPDATE/DELETE (corresponding the HTTP POST/GET/PUT/DELETE requests respectively). They are completely independent and each follows the same pattern:SettingallowCreateOperationto true will implement theapplication/jsoncontent-type with default request and response templatesThe request template forapplication/jsonrequests can be customized using thecreateRequestTemplateprop valueAdditionalrequest templates can be specified using theadditionalCreateRequestTemplatesprop value. Note - these DO NOT replace theapplication/jsoncontent-typeCustomized integration responses can be specified for any content type in thecreateIntegrationResponsesprop value.Supplying any of these values without setting allowCreateOperation to true will result in an error. This pattern is the same for all four API operations.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:Amazon API GatewayDeploy an edge-optimized API endpointEnable CloudWatch logging for API GatewayConfigure least privilege access IAM role for API GatewaySet the default authorizationType for all API methods to IAMEnable X-Ray TracingAmazon DynamoDB TableSet the billing mode for DynamoDB Table to On-Demand (Pay per request)Enable server-side encryption for DynamoDB Table using AWS managed KMS KeyCreates a partition key called 'id' for DynamoDB TableRetain the Table when deleting the CloudFormation stackEnable continuous backups and point-in-time recoveryArchitecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.