The device demo showcases a minimal app that can run in various hardware environments. It is comprised of two parts:
-
Controller app
- A small application that is responsible for sending actions to the room app, and listening for data from theRoom
to update its UI -
Room app
- The application that handles the business logic. It listens for messages from theController
and executes them. It may then send a response back to theController
to update its state
To run the device
application demo locally:
-
Ensure you have AWS credentials configured in your
~/.aws
folder for a role with a policy allowingchime:CreateMeeting
,chime:DeleteMeeting
, andchime:CreateAttendee
. -
Build dependencies:
npm run build
-
Start the webpack server:
npm run start:client
-
In another terminal in the same directory, start the node server:
npm run start:backend
-
Open two tabs or two browser windows, navigate to https://localhost:3000/ and https://localhost:3000/controller
You can deploy any of the demo as self-contained serverless application. Note: deploying the serverless demo may incur extra charges in your AWS account.
The following will create a CloudFormation stack containing a Lambda and
API Gateway deployment that runs the device
demo.
cd serverless
node ./deploy.js -r us-east-1 -b <my-bucket> -s <my-stack-name>
The script will create an S3 bucket and CloudFormation stack with Lambda and API Gateway resources required to run the demo. After the script finishes, it will output a URL that can be opened in a browser.
AWS IoT service is integrated in the device demo using Cognito identity pool for authentication.
- Log into the AWS console with your AWS credentials and go to the AWS IoT Core console
- Follow the developer guide to create IoT thing:
- Follow the developer guide to create certificate, create and attach IoT policy to certiifcate, and attach the policy to the thing created in step 2.
- Select the IoT thing and click Interact. Note down the HTTPS endpoint and replace
AWS_IOT_HTTP_ENDPOINT
in IoTClient.tsx with it.
- Log into the AWS console with your AWS credentials and go to the Amazon Cognito console
- Choose Manage Identity Pools, and then choose Create new identity pool. Type a name for the identity pool and select Enable access to unauthenticated identities from the Unauthenticated identities collapsible section. Choose Create Pool and then Allow. Note down the Identity pool ID and replace
COGNITO_IDENTITY_POOL_ID
in IoTClient.tsx with it. It will look like the following:
us-east-1:abcd1234-ab12-cd34-ef56-abcdef123456
- Navigate to AWS IAM console to add permission to the Cognito Unauthenticated IAM role
- Choose Roles and click on the 'Cognito_[IDENTITY-POOL-NAME]Unauth_Role' created in step 2. Click on the Policy, choose Edit policy and click JSON tab, copy the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"mobileanalytics:PutEvents",
"cognito-sync:*",
"cognito-identity:*",
"iot:*"
],
"Resource": [
"*"
]
}
]
}
Then click Review Policy and Save changes
Navigate to the AWS IoT console and select Test, choose Subscribe to a topic, then type in 'iot/meeting/#' and hit Subscribe to topic. When join meeting, toggle video, toggle screen share, leave and end meeting, check the Test console print out the corresponding message.
To avoid incurring future charges, please delete any resources in your account that you are not using such as files in Amazon S3, Amazon ECS and Amazon Lambda instances, AWS Cloud9 environment and Amazon API Gateway entries.
This project is licensed under the Apache-2.0 License.
Disclaimer: Deploying the Amazon Chime SDK demo applications contained in this repository will cause your AWS Account to be billed for services, including the Amazon Chime SDK, used by the application.