Stornu2
Stornu2

Reputation: 2332

How to set a AWS lambda trigger to Alexa Skills in YAML file

I'm trying to deploy my AWS Cloudformation - AWS Serverless Application Model but I can't find how to configure my Alexa Skills Kit ID and my Alexa Smart Home inside my SAM file.

This is the .yaml file that I get from export action in my Lamda console:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Serverless Specification template describing your function.
Resources:
  endesaES:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: index.handler
      Runtime: nodejs8.10
      CodeUri: .
      Code: '../myCode'
      Description: ''
      MemorySize: 256
      Timeout: 90
      Role: 'myRole/lambda_basic_execution'
      Events:
        AlexaSkillEvent:
          Type: AlexaSkill

But in there there is no code that shows my Alexa Skill ID, I have everything working and I have configured the ID in the web like shown in the image, and my Alexa Skill Test is working properly.

enter image description here

Can someone help me with information or a link that can guide me in the right direction?

Thanks in advance.

Happy coding.

Upvotes: 1

Views: 807

Answers (1)

chepukha
chepukha

Reputation: 2489

To set trigger for lambda is to give permission for something to invoke it. So to set Alexa Skill Kit as trigger you can do this.

TriggerName:
  Type: AWS::Lambda::Permission
  Properties:
    Action: 'lambda:InvokeFunction'
    FunctionName: !Ref YourLambda
    Principal: 'alexa-appkit.amazon.com'

You can see more more info here.

Upvotes: 1

Related Questions