-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yml
158 lines (145 loc) · 4.36 KB
/
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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
cognito
Example SAM project creating some basic user functionality with Cognito.
Globals:
Function:
Timeout: 60
MemorySize: 1024
Environment:
Variables:
APP_REGION: "eu-east-1"
APP_LOG_LEVEL: "info"
Handler: "main"
Runtime: "go1.x"
Resources:
RetrieveURLFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: "retrieve-url"
CodeUri: cmd/lambdas/retrieve-url
Handler: retrieve
Events:
HTTP:
Type: Api
Properties:
Path: /{shortenedId}
Method: GET
# RestApiId: !Ref RestApiId
Policies:
- DynamoDBCrudPolicy:
TableName: ShortenedUrl
ShortenURLFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: "shorten-url"
CodeUri: cmd/lambdas/shorten-url
Handler: shorten
Events:
HTTP:
Type: Api
Properties:
Path: /shortener
Method: POST
# RestApiId: !Ref RestApiId
Policies:
- DynamoDBCrudPolicy:
TableName: ShortenedUrl
ShortenedUrlTable:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain
Properties:
TableName: ShortenedUrl
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
# TimeToLiveSpecification:
# AttributeName: ttl
# Enabled: true
# StreamSpecification:
# StreamViewType: NEW_AND_OLD_IMAGES
## =====================================
## Comms
## =====================================
# FnCustomMessage:
# Type: AWS::Serverless::Function
# Properties:
# CodeUri: src/account/account-email-messager/
# Handler: index.handler
# Runtime: nodejs10.x
# ## =====================================
# ## Authentication
# ## =====================================
# DemoAuthenticatedFunction:
# Type: AWS::Serverless::Function
# Properties:
# CodeUri: src/demo-auth
# Handler: index.lambdaHandler
# Runtime: nodejs12.x
# Environment:
# Variables:
# APP_USERPOOL_CLIENT_ID: !Ref CognitoUserPoolClient
# APP_USERPOOL_ID: !Ref CognitoUserPool
# Events:
# Login:
# Type: Api
# Properties:
# Path: /demo
# Method: get
# ### ================
# ### Lambda permissions
# ### ================
# CognitoCustomMessageInvocationPermission:
# Type: AWS::Lambda::Permission
# Properties:
# Action: lambda:InvokeFunction
# FunctionName: !GetAtt FnCustomMessage.Arn
# Principal: cognito-idp.amazonaws.com
# SourceArn: !GetAtt CognitoUserPool.Arn
# ## =====================================
# ## Cognito
# ## =====================================
# CognitoUserPool:
# Type: AWS::Cognito::UserPool
# Properties:
# LambdaConfig:
# CustomMessage: !GetAtt FnCustomMessage.Arn
# AutoVerifiedAttributes:
# - email
# Policies:
# PasswordPolicy:
# MinimumLength: 8
# RequireLowercase: false
# RequireNumbers: true
# RequireSymbols: false
# RequireUppercase: false
# TemporaryPasswordValidityDays: 100
# Schema:
# - AttributeDataType: String
# Name: FullName
# - AttributeDataType: String
# Name: Birthday
# CognitoUserPoolClient:
# Type: AWS::Cognito::UserPoolClient
# Properties:
# ClientName: !Sub ${CognitoUserPool}-client
# GenerateSecret: false
# UserPoolId: !Ref CognitoUserPool
# ExplicitAuthFlows:
# - ALLOW_ADMIN_USER_PASSWORD_AUTH
# - ALLOW_CUSTOM_AUTH
# - ALLOW_USER_PASSWORD_AUTH
# - ALLOW_USER_SRP_AUTH
# - ALLOW_REFRESH_TOKEN_AUTH
# Outputs:
# 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 RegisterCreateAccountFunction.Arn