Skip to content

Commit

Permalink
Merge pull request #9 from Rungutan/feature-nat-gw-high-az
Browse files Browse the repository at this point in the history
Feature nat gw high az
  • Loading branch information
mariusmitrofan authored Jan 22, 2021
2 parents d48db5a + 5c22a9f commit 1e8ac02
Showing 1 changed file with 142 additions and 46 deletions.
188 changes: 142 additions & 46 deletions cloudformation-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Parameters:
# OpsWorks ClickHouse variables
ClickHouseCookbookUrl:
Type: String
Default: https://github.com/Rungutan/sentry-performance-monitoring/releases/download/1.3.2/clickhouse-1.3.2.tar.gz
Default: https://github.com/Rungutan/sentry-performance-monitoring/releases/download/1.4.0/clickhouse-1.4.0.tar.gz

ClickHouseInstanceType:
Type: String
Expand Down Expand Up @@ -205,28 +205,28 @@ Parameters:

SentryImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-base:1.3.2
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-base:1.3.2 <AND> Docker HUB = rungutancommunity/sentry-base:1.3.2
Default: public.ecr.aws/x7u7j5v7/sentry-base:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-base:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-base:1.4.0

SnubaImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-snuba:1.3.2
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-snuba:1.3.2 <AND> Docker HUB = rungutancommunity/sentry-snuba:1.3.2
Default: public.ecr.aws/x7u7j5v7/sentry-snuba:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-snuba:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-snuba:1.4.0

RelayImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-relay:1.3.2
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-relay:1.3.2 <AND> Docker HUB = rungutancommunity/sentry-relay:1.3.2
Default: public.ecr.aws/x7u7j5v7/sentry-relay:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-relay:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-relay:1.4.0

BashImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/bash:1.3.2
Description: Public ECR = public.ecr.aws/x7u7j5v7/bash:1.3.2 <AND> Docker HUB = rungutancommunity/bash:1.3.2
Default: public.ecr.aws/x7u7j5v7/bash:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/bash:1.4.0 <AND> Docker HUB = rungutancommunity/bash:1.4.0

ClickHouseImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/clickhouse-client:1.3.2
Description: Public ECR = public.ecr.aws/x7u7j5v7/clickhouse-client:1.3.2 <AND> Docker HUB = rungutancommunity/clickhouse-client:1.3.2
Default: public.ecr.aws/x7u7j5v7/clickhouse-client:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/clickhouse-client:1.4.0 <AND> Docker HUB = rungutancommunity/clickhouse-client:1.4.0

MinCountSnubaApi:
Type: String
Expand Down Expand Up @@ -610,22 +610,62 @@ Resources:
InternetGatewayId:
Ref: InternetGateway

NatGateway:
NatGatewayAz1:
Type: AWS::EC2::NatGateway
DependsOn: GatewayToInternet
Properties:
AllocationId:
Fn::GetAtt:
- EIP
- EIPAz1
- AllocationId
SubnetId:
Ref: PublicSubnet1
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-NatGateway"
Fn::Sub: "${AWS::StackName}-NatGateway-az-1"

EIP:
EIPAz1:
Type: AWS::EC2::EIP
Properties:
Domain: VPC

NatGatewayAz2:
Type: AWS::EC2::NatGateway
DependsOn: GatewayToInternet
Properties:
AllocationId:
Fn::GetAtt:
- EIPAz2
- AllocationId
SubnetId:
Ref: PublicSubnet2
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-NatGateway-az-2"

EIPAz2:
Type: AWS::EC2::EIP
Properties:
Domain: VPC

NatGatewayAz3:
Type: AWS::EC2::NatGateway
DependsOn: GatewayToInternet
Properties:
AllocationId:
Fn::GetAtt:
- EIPAz3
- AllocationId
SubnetId:
Ref: PublicSubnet3
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-NatGateway-az-3"

EIPAz3:
Type: AWS::EC2::EIP
Properties:
Domain: VPC
Expand Down Expand Up @@ -733,7 +773,7 @@ Resources:
Value:
Fn::Sub: "${AWS::StackName}-private-az3"

PrivateRouteTable:
PrivateRouteTableAz1:
Type: AWS::EC2::RouteTable
DependsOn: VPC
Properties:
Expand All @@ -742,59 +782,85 @@ Resources:
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-private"
Fn::Sub: "${AWS::StackName}-private-route-az1"

PrivateRoute:
DependsOn:
- PrivateRouteTable
- NatGateway
PrivateRouteAz1:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: PrivateRouteTable
Ref: PrivateRouteTableAz1
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: NatGateway
Ref: NatGatewayAz1

PrivateSubnetRouteTableAssociation1:
PrivateRouteTableAssociationAz1:
Type: AWS::EC2::SubnetRouteTableAssociation
DependsOn:
- PrivateSubnet1
- PrivateRouteTable
Properties:
SubnetId:
Ref: PrivateSubnet1
RouteTableId:
Ref: PrivateRouteTable
Ref: PrivateRouteTableAz1

PrivateRouteTableAz2:
Type: AWS::EC2::RouteTable
DependsOn: VPC
Properties:
VpcId:
Ref: VPC
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-private-route-az2"

PrivateRouteAz2:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: PrivateRouteTableAz2
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: NatGatewayAz2

PrivateSubnetRouteTableAssociation2:
PrivateRouteTableAssociationAz2:
Type: AWS::EC2::SubnetRouteTableAssociation
DependsOn:
- PrivateSubnet2
- PrivateRouteTable
Properties:
SubnetId:
Ref: PrivateSubnet2
RouteTableId:
Ref: PrivateRouteTable
Ref: PrivateRouteTableAz2

PrivateSubnetRouteTableAssociation3:
PrivateRouteTableAz3:
Type: AWS::EC2::RouteTable
DependsOn: VPC
Properties:
VpcId:
Ref: VPC
Tags:
- Key: Name
Value:
Fn::Sub: "${AWS::StackName}-private-route-az3"

PrivateRouteAz3:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: PrivateRouteTableAz3
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: NatGatewayAz3

PrivateRouteTableAssociationAz3:
Type: AWS::EC2::SubnetRouteTableAssociation
DependsOn:
- PrivateSubnet3
- PrivateRouteTable
Properties:
SubnetId:
Ref: PrivateSubnet3
RouteTableId:
Ref: PrivateRouteTable
Ref: PrivateRouteTableAz3

S3VpcEndpoint:
Type: AWS::EC2::VPCEndpoint
DependsOn:
- VPC
- PrivateRouteTable
- PublicRouteTable
Properties:
PolicyDocument:
Statement:
Expand All @@ -803,8 +869,10 @@ Resources:
Resource: "*"
Principal: "*"
RouteTableIds:
- Ref: PrivateRouteTable
- Ref: PublicRouteTable
- Ref: PrivateRouteTableAz1
- Ref: PrivateRouteTableAz2
- Ref: PrivateRouteTableAz3
ServiceName:
Fn::Sub: "com.amazonaws.${AWS::Region}.s3"
VpcId:
Expand Down Expand Up @@ -1137,6 +1205,13 @@ Resources:
- cloudwatch:*
Resource: '*'

KafkaConfigurationLambdaLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName:
Fn::Sub: /aws/lambda/${KafkaConfigurationLambdaFunction}
RetentionInDays: 3

KafkaConfigurationLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Expand Down Expand Up @@ -1557,6 +1632,13 @@ Resources:
- cloudwatch:*
Resource: '*'

KafkaGetBrokersLambdaLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName:
Fn::Sub: /aws/lambda/${KafkaGetBrokersLambdaFunction}
RetentionInDays: 3

KafkaGetBrokersLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Expand Down Expand Up @@ -1852,11 +1934,6 @@ Resources:
Ref: ListenerHTTPProxy
Priority: 1

LogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 14

ScalingRole:
Type: AWS::IAM::Role
Properties:
Expand Down Expand Up @@ -1948,6 +2025,11 @@ Resources:
- s3:HeadBucket
Resource: "*"

LogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: 3

TaskDefinitionSnubaApi:
Type: AWS::ECS::TaskDefinition
Properties:
Expand Down Expand Up @@ -5428,6 +5510,13 @@ Resources:
- cloudwatch:*
Resource: '*'

DelayResourceLambdaLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName:
Fn::Sub: /aws/lambda/${DelayResourceLambdaFunction}
RetentionInDays: 3

DelayResourceLambdaFunction:
Type: 'AWS::Lambda::Function'
Properties:
Expand Down Expand Up @@ -5507,6 +5596,13 @@ Resources:
- Fn::GetAtt: ExecutionRole.Arn
- Fn::GetAtt: TaskRole.Arn

ContainerSingleExecutionLambdaLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName:
Fn::Sub: /aws/lambda/${ContainerSingleExecutionLambdaFunction}
RetentionInDays: 3

ContainerSingleExecutionLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Expand Down

0 comments on commit 1e8ac02

Please sign in to comment.