# SAM template using intrinsic function on every property that supports it. # Translator should handle it properly Parameters: CodeBucket: Type: String Default: sam-demo-bucket FunctionName: Type: String Default: MySuperFunctionName TracingConfigParam: Type: String Default: PassThrough MyExplicitApiName: Type: String Default: SomeName CodeKey: Type: String Default: key RoleFieldName: Type: String Default: Role Conditions: TrueCondition: Fn::Equals: - true - true Resources: MyFunction: Type: AWS::Serverless::Function Properties: FunctionName: Fn::Sub: ${FunctionName} CodeUri: Bucket: Ref: CodeBucket Key: Fn::Sub: code.zip.${CodeKey} Version: Fn::Join: ['', [some, version]] Handler: Fn::Sub: ['${filename}.handler', filename: index] Runtime: Fn::Join: ['', [nodejs, '4.3']] Role: Fn::GetAtt: [MyNewRole, Arn] Tracing: Ref: TracingConfigParam Events: MyApi: Type: Api Properties: Path: / Method: GET RestApiId: Ref: MyExplicitApi MyExplicitApi: Type: AWS::Serverless::Api Properties: Name: Ref: MyExplicitApiName DefinitionUri: s3://sam-demo-bucket/swagger.yaml StageName: dev Variables: FunctionName: Fn::Sub: ${MyFunction} Var2: Fn::Join: ['join ', ['some value ', with some other value]] FunctionWithExplicitS3Uri: Type: AWS::Serverless::Function Properties: Handler: stream.ddb_handler Runtime: python2.7 CodeUri: Bucket: mybucket Key: mykey Version: MyVersion ApiWithExplicitS3Uri: Type: AWS::Serverless::Api Condition: TrueCondition Properties: StageName: dev DefinitionUri: Bucket: mybucket Key: mykey Version: 3 DynamoDBFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/streams.zip Handler: stream.ddb_handler Runtime: python2.7 Events: MyDDBStream: Type: DynamoDB Properties: Stream: Fn::GetAtt: [MyTable, StreamArn] BatchSize: 200 StartingPosition: LATEST FilterCriteria: Fn::Select: - '1' - - {} - {Filters: {Pattern: '{"value": "b"}'}} MyTable: Type: AWS::DynamoDB::Table Properties: AttributeDefinitions: - {AttributeName: id, AttributeType: S} KeySchema: - {AttributeName: id, KeyType: HASH} ProvisionedThroughput: ReadCapacityUnits: 5 WriteCapacityUnits: 5 StreamSpecification: StreamViewType: NEW_IMAGE MySqsDlqLambdaFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: python2.7 CodeUri: s3://sam-demo-bucket/hello.zip DeadLetterQueue: Type: SQS TargetArn: Fn::GetAtt: - SqsDlqQueue - Arn SqsDlqQueue: Type: AWS::SQS::Queue MySnsDlqLambdaFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: python2.7 CodeUri: s3://sam-demo-bucket/hello.zip DeadLetterQueue: Type: SNS TargetArn: Ref: SnsDlqQueue SnsDlqQueue: Type: AWS::SNS::Topic MyNewRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Statement: - Action: [sts:AssumeRole] Effect: Allow Principal: Service: [lambda.amazonaws.com] Version: '2012-10-17' Policies: - PolicyDocument: Statement: - Action: [cloudwatch:*, logs:*] Effect: Allow Resource: '*' Version: '2012-10-17' PolicyName: lambdaRole MyOtherFunction: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/hello.zip Handler: hello.handler Runtime: python2.7 FunctionWithValidGetAttAndRef: Type: AWS::Serverless::Function Properties: CodeUri: s3://sam-demo-bucket/hello.zip Handler: hello.handler Runtime: python2.7 Role: Fn::GetAtt: - MyOtherFunction - Fn::Ref: RoleFieldName