miércoles, 17 de julio de 2019

AWS ECS Reference Architecture: Continuous Deployment LAB

 ECS Reference Architecture: Continuous Deployment LAB






https://github.com/jalbertomr/ecs-demo-php-simple-app.git



 ..






 template

---
AWSTemplateFormatVersion: 2010-09-09


Description: >
  This template shows how to use AWS CodePipeline and AWS CodeBuild to build an
  automated continuous deployment pipeline to Amazon Elastic Container Service
  (Amazon ECS) using clusters powered by AWS Fargate or Amazon Elastic Compute
  Cloud (Amazon EC2).


Parameters:
  LaunchType:
    Type: String
    Default: Fargate
    AllowedValues:
      - Fargate
      - EC2
    Description: >
      The launch type for your service. Selecting EC2 will create an Auto
      Scaling group of t2.micro instances for your cluster. See
      https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html
      to learn more about launch types.

  GitHubUser:
    Type: String
    Description: Your username on GitHub.

  GitHubRepo:
    Type: String
    Default: ecs-demo-php-simple-app
    Description: The repo name of the sample service.

  GitHubBranch:
    Type: String
    Default: master
    Description: The branch of the repo to continuously deploy.

  GitHubToken:
    Type: String
    NoEcho: true
    Description: >
      Token for the user specified above. (https://github.com/settings/tokens)

  TemplateBucket:
    Type: String
    Default: ecs-refarch-continuous-deployment
    Description: >
      The S3 bucket from which to fetch the templates used by this stack.


Metadata:
  AWS::CloudFormation::Interface:
    ParameterLabels:
      GitHubUser:
        default: "User"
      GitHubRepo:
        default: "Repo"
      GitHubBranch:
        default: "Branch"
      GitHubToken:
        default: "Personal Access Token"
      LaunchType:
        default: "Launch Type"
    ParameterGroups:
      - Label:
          default: Cluster Configuration
        Parameters:
          - LaunchType
      - Label:
          default: GitHub Configuration
        Parameters:
          - GitHubRepo
          - GitHubBranch
          - GitHubUser
          - GitHubToken
      - Label:
          default: Stack Configuration
        Parameters:
          - TemplateBucket


Resources:
  Cluster:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/ecs-cluster.yaml"
      Parameters:
        LaunchType: !Ref LaunchType
        SourceSecurityGroup: !GetAtt LoadBalancer.Outputs.SecurityGroup
        Subnets: !GetAtt VPC.Outputs.Subnets
        VpcId: !GetAtt VPC.Outputs.VpcId

  DeploymentPipeline:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/deployment-pipeline.yaml"
      Parameters:
        Cluster: !GetAtt Cluster.Outputs.ClusterName
        Service: !GetAtt Service.Outputs.Service
        GitHubUser: !Ref GitHubUser
        GitHubToken: !Ref GitHubToken
        GitHubRepo: !Ref GitHubRepo
        GitHubBranch: !Ref GitHubBranch

  LoadBalancer:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/load-balancer.yaml"
      Parameters:
        LaunchType: !Ref LaunchType
        Subnets: !GetAtt VPC.Outputs.Subnets
        VpcId: !GetAtt VPC.Outputs.VpcId

  VPC:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/vpc.yaml"
      Parameters:
        Name: !Ref AWS::StackName
        VpcCIDR: 10.215.0.0/16
        Subnet1CIDR: 10.215.10.0/24
        Subnet2CIDR: 10.215.20.0/24

  Service:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Sub "https://s3.amazonaws.com/${TemplateBucket}/templates/service.yaml"
      Parameters:
        Cluster: !GetAtt Cluster.Outputs.ClusterName
        LaunchType: !Ref LaunchType
        TargetGroup: !GetAtt LoadBalancer.Outputs.TargetGroup
        SourceSecurityGroup: !GetAtt LoadBalancer.Outputs.SecurityGroup
        Subnets: !GetAtt VPC.Outputs.Subnets


Outputs:
  ServiceUrl:
    Description: The sample service that is being continuously deployed.
    Value: !GetAtt LoadBalancer.Outputs.ServiceUrl

  PipelineUrl:
    Description: The continuous deployment pipeline in the AWS Management Console.
    Value: !GetAtt DeploymentPipeline.Outputs.PipelineUrl


Error

 Me indica que el S3 bucken no es valido, este template lo proporciona el lab.
Será por permisos o configuración del template....

eot

1 comentario:

  1. Very informative blog and useful article thank you for sharing with us , keep posting learn more about aws with cloud computing

    AWS Online Training

    AWS Training

    ResponderEliminar