File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,15 @@ custom:
61
61
expression: 'cron(0 12 * * ? *)' # See https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html for more options.
62
62
task-count: 2
63
63
platform-version: 1.4.0 #Defaults to 'LATEST' which is 1.3.0 as of now. 1.3.0 does not support ECS volumes.
64
+
65
+ # You can register services with Application or Network Load Balancer target groups
66
+ my-task-with-load-balancers:
67
+ image: 123456789369.dkr.ecr.eu-west-1.amazonaws.com/my-image
68
+ loadBalancers:
69
+ - port: 8080
70
+ arn: ${self:custom.httpTargetGroupArn}
71
+ - port 8443
72
+ arn: ${self:custom.httpsTargetGroupArn}
64
73
```
65
74
66
75
Advanced usage
Original file line number Diff line number Diff line change @@ -159,6 +159,18 @@ class ServerlessFargateTasks {
159
159
}
160
160
} , service_override )
161
161
}
162
+ // Configure Load Balancers if defined.
163
+ if ( options . tasks [ identifier ] . hasOwnProperty ( 'loadBalancers' ) ) {
164
+ let loadBalancers = [ ] ;
165
+ options . tasks [ identifier ] [ 'loadBalancers' ] . forEach ( item => {
166
+ const loadBalancer = Object . assign ( {
167
+ 'ContainerName' : name ,
168
+ 'ContainerPort' : item . port ,
169
+ 'TargetGroupArn' : item . arn
170
+ } ) ;
171
+ loadBalancers . push ( loadBalancer ) ;
172
+ } ) ;
173
+ }
162
174
template [ 'Resources' ] [ normalizedIdentifier + 'Service' ] = service
163
175
}
164
176
} ) ;
You can’t perform that action at this time.
0 commit comments