Package: aws-solutions-constructs.aws-apigateway-iot
aws-apigateway-iot 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_iotTypescript@aws-solutions-constructs/aws-apigateway-iotJavasoftware.amazon.awsconstructs.services.apigatewayiotOverviewThis AWS Solutions Construct implements an Amazon API Gateway REST API connected to AWS IoT pattern.This construct creates a scalable HTTPS proxy between API Gateway and AWS IoT. This comes in handy when wanting to allow legacy devices that do not support the MQTT or MQTT/Websocket protocol to interact with the AWS IoT platform.This implementation enables write-only messages to be published on given MQTT topics, and also supports shadow updates of HTTPS devices to allowed things in the device registry. It does not involve Lambda functions for proxying messages, and instead relies on direct API Gateway to AWS IoT integration which supports both JSON messages as well as binary messages.Here is a minimal deployable pattern definition, note that the ATS endpoint for IoT must be used to avoid SSL certificate issues:Typescriptimport{Construct}from'constructs';import{Stack,StackProps}from'aws-cdk-lib';import{ApiGatewayToIot}from'@aws-solutions-constructs/aws-apigateway-iot';newApiGatewayToIot(this,'ApiGatewayToIotPattern',{iotEndpoint:'a1234567890123-ats'});Pythonfromaws_solutions_constructs.aws_apigateway_iotimportApiGatewayToIotfromaws_cdkimportStackfromconstructsimportConstructApiGatewayToIot(self,'ApiGatewayToIotPattern',iot_endpoint='a1234567890123-ats')Javaimportsoftware.constructs.Construct;importsoftware.amazon.awscdk.Stack;importsoftware.amazon.awscdk.StackProps;importsoftware.amazon.awsconstructs.services.apigatewayiot.*;newApiGatewayToIot(this,"ApiGatewayToIotPattern",newApiGatewayToIotProps.Builder().iotEndpoint("a1234567890123-ats").build());Pattern Construct PropsNameTypeDescriptioniotEndpointstringThe AWS IoT endpoint subdomain to integrate the API Gateway with (e.g a1234567890123-ats). Note that this must point to the ATS endpoint to avoid SSL certificate trust issues. The endpoint can be retrieved by runningaws iot describe-endpoint --endpoint-type iot:Data-ATS.apiGatewayCreateApiKey?booleanIf set totrue, an API Key is created and associated to a UsagePlan. User should specifyx-api-keyheader while accessing RestApi. Default value set tofalseapiGatewayExecutionRole?iam.RoleIAM Role used by the API Gateway to access AWS IoT. If not specified, a default role is created with wildcard ('*') access to all topics and things.apiGatewayProps?api.restApiPropsOptional user-provided props to override the default props for the API Gateway.logGroupProps?logs.LogGroupPropsUser provided props to override the default props for for the CloudWatchLogs LogGroup.Pattern PropertiesNameTypeDescriptionapiGatewayapi.RestApiReturns an instance of the API Gateway REST API created by the pattern.apiGatewayRoleiam.RoleReturns an instance of the iam.Role created by the construct for API Gateway.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.Default settingsOut of the box implementation of the Construct without any override will set the following defaults:Amazon API GatewayDeploy an edge-optimized API EndpointCreates API Resources withPOSTMethod to publish messages to IoT TopicsCreates API Resources withPOSTMethod to publish messages to ThingShadow & NamedShadowsEnable CloudWatch logging for API GatewayConfigure IAM role for API Gateway with access to all topics and thingsSet the default authorizationType for all API methods to IAMEnable X-Ray TracingCreates a UsagePlan and associates toprodstageBelow is a description of the different resources and methods exposed by the API Gateway after deploying the Construct. See theExamplessection for more information on how to easily test these endpoints usingcurl.MethodResourceQuery parameter(s)Return code(s)DescriptionPOST/message/<topics>qos200/403/500By calling this endpoint, you need to pass the topics on which you would like to publish (e.g/message/device/foo).POST/shadow/<thingName>None200/403/500This route allows to update the shadow document of a thing, given itsthingNameusing Unnamed (classic) shadow type. The body shall comply with the standard shadow structure comprising astatenode and associateddesiredandreportednodes. See theUpdating device shadowssection for an example.POST/shadow/<thingName>/<shadowName>None200/403/500This route allows to update the named shadow document of a thing, given itsthingNameand theshadowNameusing the Named shadow type. The body shall comply with the standard shadow structure comprising astatenode and associateddesiredandreportednodes. See theUpdating named shadowssection for an example.Architecture© Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.