forked from tarekbecker/pipeline-blogpost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2.template.yml
67 lines (64 loc) · 1.79 KB
/
2.template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Pipeline example serverless application
Outputs:
APIRoot:
Description: Url of the API
Export:
# Every export needs an account wide unique name
Name:
'Fn::Sub': '${AWS::StackName}-apiroot'
Value:
'Fn::Sub': 'https://${RestAPI}.execute-api.${AWS::Region}.amazonaws.com/prod'
Resources:
HelloWorldLambda:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
CodeUri: .
Runtime: nodejs6.10
Timeout: 3
Role: !GetAtt HelloWorldLambdaRole.Arn
Events:
RootGet:
Type: Api
Properties:
RestApiId: !Ref RestAPI
Path: /
Method: GET
RestAPI:
Type: 'AWS::Serverless::Api'
Properties:
StageName: prod
DefinitionBody:
swagger: '2.0'
info:
title: !Sub '${AWS::StackName}-API'
basePath: /prod
schemes:
- https
paths:
/:
get:
responses: {}
x-amazon-apigateway-integration:
uri: !Sub >-
arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HelloWorldLambda.Arn}/invocations
passthroughBehavior: when_no_match
httpMethod: POST
type: aws_proxy
HelloWorldLambdaRole:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Version: 2012-10-17
Path: /
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Type: 'AWS::IAM::Role'