aws / serverless-application-model

The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
https://aws.amazon.com/serverless/sam
Apache License 2.0
9.32k stars 2.38k forks source link

Add support for Alexa Smart Home Skill #158

Closed PMudra closed 6 years ago

PMudra commented 7 years ago

SAM already includes AlexaSkill as event source type. It would be great if Alexa Smart Home Skills were also supported.

For example I cannot (completely) export my lambda function when using a alexa smart home as trigger:

image

elmi82 commented 7 years ago

We are running into the same problem right now. I've spent some time today trying to figure out if it can somehow be done programmatically. But, if I did not miss anything, CloudFormation AWS::Lambda::Permission is missing support for Condition, which would be required to add the Smart Home Skill Trigger.

So the following does not work:

  AlexaSmartHomeExecutionPermission:
    Type: AWS::Lambda::Permission
    DependsOn: AlexaLambda
    Properties:
      Action: lambda:InvokeFunction
      FunctionName: !GetAtt AlexaLambda.Arn
      Principal: alexa-connectedhome.amazon.com
      Condition:
        StringEquals:
          lambda:EventSourceToken: "amzn1.ask.skill.<UUID>"

It would be great if we could specify the AWS::Serverless::Function like this:

  AlexaLambda:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: <CodeURI>
      Handler: lambda.handler
      Description: 'Amazon Alexa Service'
      MemorySize: 128
      Runtime: nodejs6.10
      Timeout: 30
      Events:
        Type: AlexaSmartHome
        Properties:
          EventSourceToken: "amzn1.ask.skill.<UUID>"
sanathkr commented 7 years ago

Thanks. This is a good feature request. We can support it natively in SAM once CloudFormation's Lambda::Permission resource supports EventSourceTokens.

Nedervino commented 7 years ago

Any update on when this might get implemented?

brettstack commented 6 years ago

Tracking this in PR #363