-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
94 lines (76 loc) · 2.34 KB
/
template.yaml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: My AWS Console - web front end for your cloud tools
# for serverless Types (this is the template specification)
# https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#resource-types
# another exmample - https://github.com/aws-samples/startup-kit-serverless-workload/blob/master/serverless.cfn.yml
Parameters:
Hostname:
Description: Used to record the DNS record (matches stack name)
Type: String
Globals:
Function:
Runtime: python3.6
Environment:
Variables:
V_EXAMPLE: example variable
Resources:
ApplicationApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
# ServiceApiDomain:
# Type : AWS::ApiGateway::DomainName
# Properties:
# DomainName: {"Fn::Join": [".", [
# {"Ref": "Hostname"},
# "domain.com"
# ]]}
# RegionalCertificateArn: {"Ref": "SomeParamater"}
# EndpointConfiguration:
# Types:
# - REGIONAL
# ServiceApiMapping:
# Type: AWS::ApiGateway::BasePathMapping
# Properties:
# DomainName: {"Ref": "ServiceApiDomain"}
# RestApiId: {"Ref": "ApplicationApi"}
# # Stage: Prod
# DnsRecord:
# Type: AWS::Route53::RecordSet
# Properties:
# Comment: "URL for MyConsole Service (SAM)"
# Type: A
# HostedZoneName: "domain.com."
# Name: {"Fn::Join": ["", [
# {"Ref": "Hostname"},
# ".",
# "domain.com", "."]]}
# AliasTarget:
# HostedZoneId: Z2OJLYMUO9EFXC
# DNSName: {"Fn::GetAtt": ["ServiceApiDomain", "RegionalDomainName"]}
ConsoleService:
Type: AWS::Serverless::Function
Properties:
Description: Provides GET support for console UI
Handler: index.handler
CodeUri: ./lambda/console
Events:
GetService:
Type: Api
Properties:
Path: /service
Method: get
RestApiId: !Ref ApplicationApi
CallService:
Type: Api
Properties:
Path: /service/{serviceId}
Method: post
RestApiId: !Ref ApplicationApi
NewMessageTopic:
Type: AWS::SNS::Topic
Outputs:
ApiURL:
Description: "API URL"
Value: !Sub 'https://${ApplicationApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/'