-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
118 lines (113 loc) · 2.55 KB
/
serverless.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
service: test
plugins:
- serverless-offline
- serverless-dotenv-plugin
- serverless-vpc-plugin
- serverless-dependson-plugin
package:
exclude:
- .git/**
- .vscode/**
- .env.development
- task1/**
custom:
serverless-offline:
host: 0.0.0.0
dontPrintOutput: true
vpcConfig:
cidrBlock: 10.0.0.0/16
createNatGateway: true
zones:
- us-east-1a
- us-east-1b
- us-east-1c
subnetGroups:
- rds
provider:
name: aws
runtime: nodejs10.x
stage: prod
timeout: 30
region: us-east-1
logRetentionInDays: 30
vpc:
securityGroupIds:
- Ref: LambdaExecutionSecurityGroup
subnetIds:
- Ref: AppSubnet1
- Ref: AppSubnet2
- Ref: AppSubnet3
iamRoleStatements:
- Effect: Allow
Action:
- ecs:RunTask
Resource: '*'
- Effect: Allow
Action:
- iam:PassRole
Resource:
Fn::Join:
- ''
- - 'arn:aws:iam::'
- Ref: 'AWS::AccountId'
- ':role/ecsTaskExecutionRole'
environment:
FARGATE_CLUSTER: ${self:service}
SECURITY_GROUP:
'Fn::GetAtt': [LambdaExecutionSecurityGroup, GroupId]
SUBNETS:
Fn::Join:
- ','
- - Ref: AppSubnet1
- Ref: AppSubnet2
- Ref: AppSubnet3
functions:
app:
handler: handler.app
events:
- http:
path: /
method: ANY
- http:
path: /{proxy+}
method: ANY
resources:
Resources:
ECRRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: ${self:service}
ECSCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: ${self:service}
ECSTask1:
Type: AWS::ECS::TaskDefinition
Properties:
Cpu: 256
ExecutionRoleArn: ecsTaskExecutionRole
Family: Task1
Memory: 0.5GB
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn: ecsTaskExecutionRole
ContainerDefinitions:
- Name: Task1
Image:
Fn::Join:
- ''
- - Ref: 'AWS::AccountId'
- '.dkr.ecr.'
- Ref: 'AWS::Region'
- '.amazonaws.com/'
- Ref: ECRRepository
- ':task1'
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group:
Ref: AppLogGroup
awslogs-region:
Ref: AWS::Region
awslogs-stream-prefix: Task1