From 3e052413e161cc2e3e4919e4820778c3ce96ec91 Mon Sep 17 00:00:00 2001 From: Brent Langston Date: Fri, 19 Jan 2018 09:33:08 -0600 Subject: [PATCH] initial commit --- README.md | 3 ++ backend-service/common-iam.yml | 29 ++++++++++++ backend-service/elb.yml | 73 +++++++++++++++++++++++++++++ backend-service/mu-extension.yml | 8 ++++ buildspec.yml | 11 +++++ images/web-app-ecs-architecture.svg | 4 ++ mu.yml | 13 +++++ 7 files changed, 141 insertions(+) create mode 100644 README.md create mode 100644 backend-service/common-iam.yml create mode 100644 backend-service/elb.yml create mode 100644 backend-service/mu-extension.yml create mode 100644 buildspec.yml create mode 100644 images/web-app-ecs-architecture.svg create mode 100644 mu.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..ae73581 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Amazon ECS Workshop + +This is part of an Amazon ECS workshop at https://ecsworkshop.com diff --git a/backend-service/common-iam.yml b/backend-service/common-iam.yml new file mode 100644 index 0000000..c658f63 --- /dev/null +++ b/backend-service/common-iam.yml @@ -0,0 +1,29 @@ +--- +Resources: + CloudFormationRole: + Type: AWS::IAM::Role + Properties: + RoleName: + Fn::Sub: ${Namespace}-cloudformation-common-${AWS::Region} + AssumeRolePolicyDocument: + Statement: + - Effect: Allow + Principal: + Service: + - cloudformation.amazonaws.com + Action: + - sts:AssumeRole + Path: "/" + Policies: + - PolicyName: update-route53-additional + PolicyDocument: + Version: '2012-10-17' + Statement: + - Action: + - route53:CreateHostedZone + - route53:GetHostedZone + - route53:DeleteHostedZone + - route53:UpdateHostedZoneComment + - route53:ListQueryLoggingConfigs + Resource: '*' + Effect: Allow diff --git a/backend-service/elb.yml b/backend-service/elb.yml new file mode 100644 index 0000000..1a01a7a --- /dev/null +++ b/backend-service/elb.yml @@ -0,0 +1,73 @@ +--- +Resources: + DnsBackend: + Type: "AWS::Route53::HostedZone" + Properties: + Name: "internal.service" + VPCs: + - + VPCRegion: + Fn::Sub: ${AWS::Region} + VPCId: + Fn::ImportValue: + Fn::Sub: ${VpcId} + BackendLB: + Type: AWS::ElasticLoadBalancingV2::LoadBalancer + Properties: + Scheme: internal + SecurityGroups: + - Ref: ElbSG + Subnets: + Fn::Split: + - ',' + - Fn::ImportValue: + Fn::Sub: ${ElbSubnetIds} + Tags: + - Key: Name + Value: + Ref: AWS::StackName + BackendLBHttpListener: + Type: AWS::ElasticLoadBalancingV2::Listener + Properties: + DefaultActions: + - TargetGroupArn: + Ref: BackendLBTargetGroup + Type: forward + LoadBalancerArn: + Ref: BackendLB + Port: "80" + Protocol: HTTP + BackendLBTargetGroup: + Type: AWS::ElasticLoadBalancingV2::TargetGroup + Properties: + Port: "8080" + Protocol: HTTP + Tags: + - Key: Name + Value: internal + VpcId: + Fn::ImportValue: + Fn::Sub: ${VpcId} + BackendLBDns: + Type: AWS::Route53::RecordSetGroup + Properties: + Comment: DNS for Internal ELB in ${AWS::StackName} + HostedZoneId: + Ref: DnsBackend + RecordSets: + - AliasTarget: + DNSName: + Fn::GetAtt: BackendLB.DNSName + EvaluateTargetHealth: true + HostedZoneId: + Fn::GetAtt: BackendLB.CanonicalHostedZoneID + Name: api.internal.service. + Type: A +Outputs: + BackendLBHttpListenerArn: + Description: Arn of the Backend ELB HTTP Listener. + Export: + Name: + Fn::Sub: ${AWS::StackName}-BackendLBHttpListenerArn + Value: + Ref: BackendLBHttpListener diff --git a/backend-service/mu-extension.yml b/backend-service/mu-extension.yml new file mode 100644 index 0000000..8fe7fdb --- /dev/null +++ b/backend-service/mu-extension.yml @@ -0,0 +1,8 @@ +name: backend-service +version: 1.0 + +templateUpdateMode: merge + +# Note: the filename must match the asset being extended. +# see https://github.com/stelligent/mu/tree/develop/templates/assets for +# filenames. diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 0000000..420f9ac --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,11 @@ +version: 0.2 + +phases: + build: + commands: + - echo '...replace with real build commands...' + +artifacts: + files: + - '**/*' + diff --git a/images/web-app-ecs-architecture.svg b/images/web-app-ecs-architecture.svg new file mode 100644 index 0000000..9f86f5a --- /dev/null +++ b/images/web-app-ecs-architecture.svg @@ -0,0 +1,4 @@ + + +AmazonAmazonRoute 53Route 53AAFrontend ALBFrontend ALBBackend ALBBackend ALBAvailability ZoneAvailability ZoneAvailability ZoneAvailability ZoneAZAZCCAZAZAZAZBBAvailability ZoneAvailability Zone \ No newline at end of file diff --git a/mu.yml b/mu.yml new file mode 100644 index 0000000..96d7bd7 --- /dev/null +++ b/mu.yml @@ -0,0 +1,13 @@ +--- +environments: + - name: acceptance + provider: ecs-fargate + - name: production + provider: ecs-fargate +service: + acceptance: + disabled: true + production: + disabled: true +extensions: + - url: backend-service