aws-iot-dragonconnect-c

Arrow DragonConnect

Overview

The DragonConnect API is defined using Swagger and configured and deployed using the Amazon API Gateway Importer.

Create

The Amazon API Gateway Importer is a Java application. If you would like to download and compile the application you will need a Java 8 SDK and Apache Maven. As a convenience, we have included a recent compiled version in the lib directory.

The configuration of the API requires the account number, deployment region, and extension used to create a unique IAM role. In order to find the extension, use the following command (remember to use a backtick (`) surrounding the DragonConnect-ApiGateway string)

$ aws iam list-roles \
--query 'Roles[?RoleName.contains(@, `DragonConnect-ApiGateway`)].RoleName' \
--output text
DragonConnect-ApiGateway-59f4

With this information, edit the template api/dragonconnect-template.yaml, and replace the account number, deployment region, and extension. If available, you may also choose to use an operating system command such as sed

$ cd api
$ sed -e 's/${region}/us-east-1/g' \
-e 's/${accountNumber}/012345678901/g' \
-e 's/${ext}/59f4/g' dragonconnect-template.yaml > dragonconnect.yaml

The API Gateway may now be used to create the API and deploy it to a stage. The following command deploys the API to the dev stage. Remember the stage name you choose, as it will be needed when configuring the dashboard.

$ java -jar lib/aws-apigateway-importer.jar --create \
--deploy dev dragonconnect.yaml

The following command will validate that the API has been configured and deployed to the dev stage (the value of the --deploy parameter used in the previous command)

$ aws apigateway get-stage --rest-api-id \
$(aws apigateway get-rest-apis \
--query 'items[?name.contains(@, `DragonConnect`)].id' --output text) \
--stage-name dev 

The stageName attribute of the result from the above command should match "dev".

Delete

The API Gateway configuration may be deleted through the AWS console or by using the command

$ aws apigateway delete-rest-api --rest-api-id $(aws apigateway get-rest-apis \
--query 'items[?name.contains(@, `DragonConnect`)].id' --output text)

Home