Skip to content

Instantly share code, notes, and snippets.

@eulersson
Created February 20, 2019 00:06
Show Gist options
  • Save eulersson/7ffb221e4b9e5555c8647ec54a5d2630 to your computer and use it in GitHub Desktop.
Save eulersson/7ffb221e4b9e5555c8647ec54a5d2630 to your computer and use it in GitHub Desktop.
BackendService:
Type: AWS::ECS::Service
Properties:
ServiceName: ecsfs-backend-service
Cluster: !Ref ECSCluster
LaunchType: FARGATE
DesiredCount: 1
ServiceRegistries: # And that's how you associate ecsfs-backend.local!
- RegistryArn: !GetAtt BackendLocalDiscoveryService.Arn
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: DISABLED
SecurityGroups:
- !Ref FargateContainerSecurityGroup
Subnets:
- !Ref PrivateSubnet
TaskDefinition: !Ref BackendTaskDefinition
FrontendService:
Type: AWS::ECS::Service
Properties: # Associates it with the DNS name ecsfs-frontend.local.
ServiceName: ecsfs-frontend-service
Cluster: !Ref ECSCluster
LaunchType: FARGATE
DesiredCount: 1
ServiceRegistries:
- RegistryArn: !GetAtt FrontendLocalDiscoveryService.Arn
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: DISABLED
SecurityGroups:
- !Ref FargateContainerSecurityGroup
Subnets:
- !Ref PrivateSubnet
TaskDefinition: !Ref FrontendTaskDefinition
# The application load balancer routes the requests to the nginx service,
# therefore we need to wait for the ALB to finish before we can actually spin
# up the nginx service.
NginxService:
Type: AWS::ECS::Service
DependsOn: ListenerHTTP
Properties:
ServiceName: ecsfs-nginx-service
Cluster: !Ref ECSCluster
LaunchType: FARGATE
DesiredCount: 1
ServiceRegistries: # Associate it with ecsfs-nginx.local DNS name.
- RegistryArn: !GetAtt NginxLocalDiscoveryService.Arn
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
SecurityGroups:
- !Ref FargateContainerSecurityGroup
Subnets:
- !Ref PublicSubnetOne
- !Ref PublicSubnetTwo
TaskDefinition: !Ref NginxTaskDefinition
LoadBalancers:
- ContainerName: ecsfs-nginx-container
ContainerPort: 80
TargetGroupArn: !Ref TargetGroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment