Aws CodePipeline to Deploy to ECS Cluster using AWS CLI

0

I am using AWS CodePipeline to create a CICD. I am using Bitbucket as a source, using CodeBuid and Amazon CodePipeline. I have done this using console but now I want to create CodePipeline using AWS CLI. For this, we have to create a JSON file that holds the configuration. I want to deploy my application to ECS but I don't find any JSON format to do this. Here you can see the JSON file:

{
  "pipeline": {
    "roleArn": "arn:aws:iam::74555555530:role/service-role/AWSCodePipelineServiceRole-us-east-1-HubspotConnector",
    "stages": [
      {
    "Name": "Source",
    "Actions": [
        {
            "InputArtifacts": [],
            "ActionTypeId": {
                "Version": "1",
                "Owner": "AWS",
                "Category": "Source",
                "Provider": "CodeStarSourceConnection"
            },
            "OutputArtifacts": [
                {
                    "Name": "SourceArtifact"
                }
            ],
            "RunOrder": 1,
            "Configuration": {
                "ConnectionArn": "arn:aws:codestar-connections:us-east-1:747926693930:connection/5b2xxxx2-2xxf-4xx0-9xx3-xxcfxxxxx72f",
                "FullRepositoryId": "an-c/rpipeline",
                "BranchName": "xxxxxx",
                "OutputArtifactFormat": "CODE_ZIP"
            },
            "Name": "ApplicationSource"
        }
    ]
},
      {
        "name": "Build",
        "actions": [
          {
            "inputArtifacts": [
              {
                "name": "SourceArtifact"
              }
            ],
            "name": "Build",
            "actionTypeId": {
              "category": "Build",
              "owner": "AWS",
              "version": "1",
              "provider": "CodeBuild"
            },
            "outputArtifacts": [
              {
                "name": "default"
              }
            ],
            "configuration": {
              "ProjectName": "cicdCli"
            },
            "runOrder": 1
          }
        ]
      }
    ],
    "artifactStore": {
      "type": "S3",
      "location": "codepipeline-us-east-1-16896969692329"
    },
    "name": "newPipelineCicd",
    "version": 1
  }
}

It has source stage, build stage but I don't know how to write build stage (for Deploy to ECS). Can someone guide me what are the exact parameters for build stage (ECS deployment).

1개 답변
0

In order to check for the Json format of the ECS Deployment stage in the AWS CodePipeline, you can refer the below document :

[] Amazon Elastic Container Service - Action declaration - https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-ECS.html#action-reference-ECS-example

Further, I would also recommend you to checkout this[1] document to know more about the 'CodePipeline pipeline structure' in detail.

Also, feel free to refer these[2][3] documents which consists of the step by step tutorial to deploy to Amazon ECS using AWS Codepipeline.

References :

[1] CodePipeline pipeline structure reference - https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html

[2] Tutorial: Amazon ECS Standard Deployment with CodePipeline - https://docs.aws.amazon.com/codepipeline/latest/userguide/ecs-cd-pipeline.html

[3] Tutorial: Create a pipeline with an Amazon ECR source and ECS-to-CodeDeploy deployment - https://docs.aws.amazon.com/codepipeline/latest/userguide/tutorials-ecs-ecr-codedeploy.html

AWS
지원 엔지니어
Ankur_P
답변함 2년 전
  • I ran a command for the CodePipeline skeleton that returned me the skeleton of pipeline. But it contains some of the fields that aren't defined anywhere in the documentation like this: "stages": [ { "name": "", "blockers": [ { "name": "", "type": "Schedule" } What are blockers? can you tell me? can you tell me where these are defined? The tutorial link you shared with me isn't showed codepipeline creation from AWS CLI instead it is showing me creation of CodePipeline via console, which I have already done. It has been more than two weeks for searching a proper format and those fields describption. I didn't expect that kind of blunder from AWS.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠