I am currently trying to use code pipeline to perform an ecs blue green deployment. I have a task definition that is defined like this:
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: "Project-Grafana-task"
Cpu: 512
Memory: 1024
NetworkMode: awsvpc
TaskRoleArn: !Ref Role
ExecutionRoleArn: !GetAtt ExecutionRole.Arn
RequiresCompatibilities:
- FARGATE
- EC2
ContainerDefinitions:
- Name: Grafana
Image: grafana/grafana
PortMappings:
- ContainerPort: 3000
MountPoints:
- SourceVolume: Grafana-home
ContainerPath: /var/Grafana_home
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group: !Ref CloudwatchLogsGroup
awslogs-region: !Ref AWS::Region
awslogs-stream-prefix: Grafana
Volumes:
- Name: Grafana-home
EFSVolumeConfiguration:
FilesystemId: !GetAtt TaskNetworking.Outputs.FileSystemID
TransitEncryption: ENABLED
AuthorizationConfig:
AccessPointId: !GetAtt TaskNetworking.Outputs.AccessPointId
IAM: ENABLED
And a taskdef.json file that looks like:
{
"Family":"Project-Grafana-task",
"Cpu": 512,
"Memory": 1024,
"NetworkMode": "awsvpc",
"TaskRoleArn": "arn:aws:iam::xxxxxxxxxx:role/grafana-role",
"ExecutionRoleArn": "arn:aws:iam::xxxxxxxx:role/grafana-execution-role",
"RequiresCompatibilities": [
"FARGATE",
"EC2"
],
"ContainerDefinitions": [
{
"Name": "Grafana",
"Image": "<IMAGE1_NAME>",
"PortMappings": [
{
"ContainerPort": 3000
}
],
"MountPoints": [
{
"SourceVolume": "Grafana-home",
"ContainerPath": "/var/Grafana_home"
}
],
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
"awslogs-group": "CloudwatchLogsGroup",
"awslogs-region": "eu-west-1",
"awslogs-stream-prefix": "Grafana"
}
}
}
],
"Volumes": [
{
"Name": "Grafana-home",
"EFSVolumeConfiguration": {
"FilesystemId": "xxxxxxxxxxxx",
"TransitEncryption": "ENABLED",
"AuthorizationConfig": {
"AccessPointId": "xxxxxxxxxxxxxx",
"IAM": "ENABLED"
}
}
}
]
}
When trying to run the pipeline this returns the error:
Family can not be blank.
Have I missed a place where family can be defined, my current understanding is that if the taskdef.json and the appspec.json (which is also included) get passed to the code deploy part of the pipe line I should get a blue/green deployment. Also worth noting the code deploy job is already set up as well.
The taskdef.json needs the keys to be camel case so Family needs to be family and MountPoints would need to be mountPoints