Skip to content

Instantly share code, notes, and snippets.

View eulersson's full-sized avatar

Ramon Blanquer eulersson

View GitHub Profile
VPC:
Type: AWS::EC2::VPC
Properties:
EnableDnsSupport: true
EnableDnsHostnames: true
CidrBlock: 10.0.0.0/16
Tags: # You can give
- Key: Name # pretty names to
Value: ECSFS VPC # your resources.
InternetGateway:
Type: AWS::EC2::InternetGateway
GatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
PublicRouteTable:
NatElasticIP:
Type: AWS::EC2::EIP
NatGateway:
Type: AWS::EC2::NatGateway
Properties:
AllocationId: !GetAtt NatElasticIP.AllocationId
SubnetId: !Ref PublicSubnetOne
PrivateRouteTable:
FargateContainerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Access to Fargate containers.
VpcId: !Ref VPC
IngressFromPublicALBSecurityGroup:
Type: AWS::EC2::SecurityGroupIngress
Properties:
Description: Ingress from the public Application Load Balancer.
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Name: ecsfs-target-group
Port: 80
Protocol: HTTP
TargetType: ip
VpcId: !Ref VPC
ListenerHTTP:
ECSCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: ecsfs-cluster
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: ecsfs-logs
ExecutionRole:
Type: AWS::IAM::Role
Properties:
RoleName: ecsfs-execution-role
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Action: sts:AssumeRole
BackendTaskDefinition:
Type: AWS::ECS::TaskDefinition
DependsOn: LogGroup
Properties:
Family: ecsfs-backend-td
Cpu: 256
Memory: 1024
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
LocalNamespace:
Type: AWS::ServiceDiscovery::PrivateDnsNamespace
Properties:
Vpc: !Ref VPC
Name: local
NginxLocalDiscoveryService:
Type: AWS::ServiceDiscovery::Service
Properties:
Name: ecsfs-nginx