Amazon ECS Blue/Green deployment on Codepipeline
2023. 8. 23. 15:50ㆍAWS/AWS CodePipeline
728x90
SMALL
- 필요 사항
ELB TG 2개
ECS service >> Deployment Type >> Blue green deployment (With CodeDeploy)
AWS CodeDeploy application
AWS CodeDeploy Deployment group
taskdef.json
appspec.yaml
CodeDeploy
- ECS service
Deployment Type
>> Blue green deployment (With CodeDeploy)
>>> create AWS CodeDeploy application
>>> create AWS CodeDeploy Deployment group
- taskdef.json
{
"executionRoleArn":"<use-your-role",
"containerDefinitions": [{
"name": "<use-your-container-name>",
"image": "<use-your-container-image>",
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group" : "/ecs/fargate-task-definition",
"awslogs-region": "<your-region>",
"awslogs-stream-prefix": "ecs"
}
},
"essential": true,
"portMappings": [{
"hostPort": <use-your-port>,
"protocol": "<use-your-protocol>",
"containerPort": <use-your-port>
}]
}],
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "1024",
"memory": "2048",
"family": "<use-your-taskdefinition-name>"
}
- appspec.yaml
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: <TASK_DEFINITION>
LoadBalancerInfo:
ContainerName: "<use-your-container-name>"
ContainerPort: <use-your-port>
PlatformVersion: "LATEST"
- CodeDeploy
Action name >> Deploy
Action provider >> Amazon ECS (Blue/Green)
Region >> <your-region>
Input artifacts >> SourceArtifact
AWS CodeDeploy application name >> <your-codedeploy-app-name>
AWS CodeDeploy deployment group >> <your-codedeploy-group-name>
Amazon ECS task definition >> SourceArtifact // taskdef-dev.json
AWS CodeDeploy AppSpec file >> SourceArtifact // appspec-dev.yaml
728x90
LIST
'AWS > AWS CodePipeline' 카테고리의 다른 글
AWS CodePipeline V2 (0) | 2023.11.01 |
---|---|
Exception while trying to read the task definition artifact file from: <source artifact name> (0) | 2023.08.25 |
Codepipeline IAM Managed Policy (1) | 2022.08.09 |