For this sample you will need backend AWS resources that support the skill. Using the Alexa Skill ID from the previous step, you will create a CloudFormation Stack using a provided template that generates the following in your AWS account:
- An IAM Lambda Execution Role with a restrictive Policy
- An AWS Lambda Function with Triggers configured for Alexa using the restrictive Role
- A Simple Queue Service (SQS) Queue for messages to our device
Access the AWS CloudFormation console in your preferred region and load a template file to provision backend resources.
- Login to the AWS Console for CloudFormation at https://console.aws.amazon.com/cloudformation/home (then select the region that is most appropriate for your smart home locale of choice, eg. for North America choose us-east-1, for Europe and India choose eu-west-1 and for Far East choose us-west-1).
- Click Create stack and select With new resources (standard).
- Select Template is ready and Upload a template file. If you are attending a workshop in the US, choose the
workshop.multi.template.json(US) or, if you're in EU, select theworkshop.eu.multi.template.json(EU) file from the /cloudformation directory in your working directory. If you're doing this outside a workshop just select theself.multi.template.json(US) or theself.eu.multi.template.json(EU) file. Theworkshoptemplates will append the word "workshop" by default to a bunch of resources in the stack so they don't cause conflicts with your personal deployment of this project if available (in any case you can change this in the stack parameters). - Click Next.
- For the Stack name on the Stack Details page, enter
skill-sample-nodejs-multi. - In the AlexaSkillId field of the Parameters, enter the Alexa Skill ID of the previously created skill stored in the [Alexa Skill Application ID] section of the
setup.txtfile. - If you are attending a workshop you should see a Code field of the Parameters verify it is
workshopor leave it with a default value. - Click the Next button.
- On the Options page, no changes are needed and you can just click the Next button.
- On the Review page, check the I acknowledge that AWS CloudFormation might create IAM resources. check box and then click the Create stack button.
The status of the stack should start as
CREATE_IN_PROGRESSand complete after a couple of minutes. You can view the status of the stack creation on the CloudFormation console.
After the stack completes, collect the created resource identifiers.
-
When the skill-sample-nodejs-multi stack is created, you will see its Status reported as
CREATE_COMPLETE. -
From the Outputs tab of the stack, collect value of the
BeeperFunctionLambdaArnkey and store it into the [AWS Lambda ARN] section of thesetup.txtfile in your working directory. It will look something like the following:arn:aws:lambda:region:XXXXXXXXXXXX:function:skill-sample-nodejs-multi. -
While in the Outputs tab, also collect the
BeeperSqsQueueUrlvalue and store it in the [Amazon SQS Queue Url] section of thesetup.txtfile.[AWS Lambda ARN] arn:aws:lambda:region:XXXXXXXXXXXX:function:skill-sample-nodejs-multi [Amazon SQS Queue Url] https://sqs.region.amazonaws.com/XXXXXXXXXXXX/BeeperEventQueue
In your AWS environment, you should now have the following resources available to you:
- An IAM Lambda Execution Role with a restrictive Policy
- An AWS Lambda Function with Triggers configured for Alexa using the restrictive Role
- A Simple Queue Service (SQS) Queue for messages to our device
You should also have saved the Lambda ARN and SQS Queue URL to be used later during configuration.
Next to Step 5. Create a Security Profile
Return to the Instructions