-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemplate.yaml
More file actions
91 lines (85 loc) · 2.28 KB
/
template.yaml
File metadata and controls
91 lines (85 loc) · 2.28 KB
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
AWSTemplateFormatVersion: 2010-09-09
Description: Group 1 Serverless project
Resources:
# IAM
LambdaPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: sociallyawkwardpolicy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- dynamodb:BatchGetItem
- dynamodb:GetItem
- dynamodb:Scan
- dynamodb:Query
- dynamodb:BatchWriteItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: arn:aws:dynamodb:eu-north-1:235920682125:table/socially-awkward
Roles:
- !Ref LambdaRole
LambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
# Policies:
# - !Ref LambdaPolicy
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
# Lambda
Lambda:
Type: AWS::Lambda::Function
DependsOn: LambdaPolicy
Properties:
Code:
S3Bucket: arn:aws:s3:::socially-awkward
S3Key: lambda.zip
FunctionName: socially-awkward-cw
Handler: index.handler
PackageType: Zip
Runtime: nodejs16.x
Role: !GetAtt LambdaRole.Arn
# API Gateway
APIGateway:
Type: AWS::ApiGateway::RestApi
Properties:
EndpointConfiguration:
Types:
- REGIONAL
Description: Socially Awkward API
Name: socially-awkward-cw
GetMethod:
Type: "AWS::ApiGateway::Method"
Properties:
RestApiId: !Ref APIGateway
ResourceId: !GetAtt
- APIGateway
- RootResourceId
HttpMethod: GET
AuthorizationType: NONE
Integration:
Type: MOCK
# SNS
SNSTopic:
Type: AWS::SNS::Topic
Properties:
Subscription:
- Endpoint: emmi.lahtisalo@awacademy.training
Protocol: email
- Endpoint: youwillcopyandpastethisanyway@gmail.com
Protocol: email
TopicName: socially-awkward-api
# Outputs:
# SNSTopicArn:
# Description: Arn of Created SNS Topic
# Value: !Ref SNSTopic