This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_ecs_cluster" "my_cluster" { | |
| name = "my-cluster" # Naming the cluster | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider "aws" { | |
| version = "~> 2.0" | |
| region = "eu-west-2" # Setting my region to London. Use your own region here | |
| } | |
| resource "aws_ecr_repository" "my_first_ecr_repo" { | |
| name = "my-first-ecr-repo" # Naming my repository | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: 2010-09-09 | |
| Resources: | |
| VPC: | |
| Type: AWS::EC2::VPC | |
| Properties: | |
| CidrBlock: 10.0.0.0/16 | |
| PublicSubnetA: | |
| Type: AWS::EC2::Subnet |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Database: | |
| Type: AWS::RDS::DBInstance # (1) | |
| Properties: | |
| VPCSecurityGroups: | |
| - !Ref DbSecurityGroup # (2) | |
| AllocatedStorage: "10" | |
| DBSubnetGroupName: !Ref DbSubnetGroup # (3) | |
| DBInstanceClass: "db.t2.micro" | |
| Engine: "postgres" | |
| MasterUsername: Username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| InstanceSecurityGroup: | |
| Type: AWS::EC2::SecurityGroup | |
| Properties: | |
| GroupDescription: Letting HTTP into our instance | |
| VpcId: !Ref VPC | |
| SecurityGroupIngress: | |
| - FromPort: 80 | |
| IpProtocol: tcp | |
| ToPort: 80 | |
| SourceSecurityGroupId: !Ref ApplicationLoadBalancerSecurityGroup # (1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ApplicationLoadBalancer: | |
| Type: AWS::ElasticLoadBalancingV2::LoadBalancer # (1) | |
| Properties: | |
| SecurityGroups: | |
| - !Ref ApplicationLoadBalancerSecurityGroup # (2) | |
| Subnets: # (3) | |
| - !Ref PublicSubnetA | |
| - !Ref PublicSubnetB | |
| ApplicationLoadBalancerSecurityGroup: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ApplicationLoadBalancerSecurityGroup: | |
| Type: AWS::EC2::SecurityGroup # (4) | |
| Properties: | |
| GroupDescription: SSH and HTTP | |
| VpcId: !Ref VPC | |
| SecurityGroupIngress: # (5) | |
| - CidrIp: 0.0.0.0/0 | |
| FromPort: 80 | |
| IpProtocol: tcp | |
| ToPort: 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PublicRouteTable: # (1) | |
| Type: AWS::EC2::RouteTable # (2) | |
| Properties: | |
| VpcId: !Ref VPC # (3) | |
| PublicRoute: # (4) | |
| Type: AWS::EC2::Route # (5) | |
| DependsOn: AttachGateway | |
| Properties: | |
| RouteTableId: !Ref PublicRouteTable # (6) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| InternetGateway: # (1) | |
| Type: AWS::EC2::InternetGateway # (2) | |
| DependsOn: VPC | |
| AttachGateway: # (2) | |
| Type: AWS::EC2::VPCGatewayAttachment # (4) | |
| Properties: | |
| VpcId: !Ref VPC # (5) | |
| InternetGatewayId: !Ref InternetGateway # (6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AutoScalingGroup: | |
| Type: AWS::AutoScaling::AutoScalingGroup | |
| Properties: | |
| LaunchConfigurationName: !Ref AppLaunchConfig | |
| # AvailabilityZones: | |
| # - !Select [0, !GetAZs ] | |
| # - !Select [1, !GetAZs ] | |
| VPCZoneIdentifier: # (1) | |
| - !Ref PublicSubnetA | |
| - !Ref PublicSubnetB |