Skip to content

Instantly share code, notes, and snippets.

@trevorbennett
Created July 20, 2021 04:21
Show Gist options
  • Save trevorbennett/2c6966bf3cf7499630f022425a57ec93 to your computer and use it in GitHub Desktop.
Save trevorbennett/2c6966bf3cf7499630f022425a57ec93 to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
ses-example
Sample SAM Template for ses-example
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Parameters:
dish:
Type: String
Default: Cake
elderberryDish:
Type: String
Default: pudding
Resources:
apple:
Type: AWS::SSM::Parameter
Properties:
Type: String
Value: Cruller
banana:
Type: AWS::SSM::Parameter
Properties:
AllowedPattern: "^[A-z]+$"
DataType: text
Description: This is our Description
Name: Banana
# Policies: '[{ "Type":"Expiration","Version":"1.0", "Attributes":{ "Timestamp":"2030-12-02T21:34:33.000Z"}}]'
Tags: {"create-date":"2021-07-19", "author": "John Doe"}
Tier: Standard
Type: String
Value: Bread
cherry:
Type: AWS::SSM::Parameter
Properties:
Type: String
Value: Cherry Pie
Name: Cherry
Description: The parameter to track the type of cherry dish we cook
dragonfruit:
Type: AWS::SSM::Parameter
Properties:
Type: String
Value: !Sub "Dragonfruit ${dish}"
Name: Dragonfruit
Description: The parameter to track the type of dragonfruit dish we cook
elderberry:
Type: AWS::SSM::Parameter
Properties:
Type: String
Value: !Ref elderberryDish
Name: Elderberry
Description: The parameter to track the type of elderberry dish we cook
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
Runtime: nodejs14.x
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: get
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
HelloWorldFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt HelloWorldFunction.Arn
HelloWorldFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt HelloWorldFunctionRole.Arn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment