Hey all, I'm struggling to come up with a good wa...
# aws
t
Hey all, I'm struggling to come up with a good way of doing ECS blue /green deployments via pulumi I see there a few open issues on this https://github.com/pulumi/pulumi-aws/issues/1096 Up until now I had been using standard ECS deployment with the folowing fargate service
Copy code
const service = new awsx.ecs.FargateService('templi-api', {
  cluster: baseInfra.requireOutput('clusterArn'),
  enableExecuteCommand: true,


  networkConfiguration: {
    securityGroups: [apiSecurityGroup.id],
    assignPublicIp: true,
    subnets: baseInfra.requireOutput('vpcPublicSubnetIds'),
  },

  taskDefinitionArgs: {
    taskRole: {
      roleArn: taskRole.arn,
    },

    container: {
      name: 'templi-api',
      image: apiImage.imageUri,
      cpu: 128,
      memory: 512,

      essential: true,

      portMappings: [
        {
          containerPort: 80,
          targetGroup: blueTargetGroup,
        },
      ],
    },
  },
});
Everytime I ran
pulumi up
pulumi would build a new docker image, and update my service task definition accordingly This worked great But I have been a little bit disappointed when trying to use the same worfklow but with CodeDeploy as my deployment contrller
Copy code
deploymentController: {
    type: 'CODE_DEPLOY',
  },
With accompanying code deploy infra provisioned, when running
pulumi up
i get the following error
Copy code
InvalidParameterException: Unable to update task definition on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment.
Which seems to be a limitation from AWS https://github.com/aws/aws-cdk/issues/1559 (which has since been resolved by a new L2 Construct in the CDK) my question is, are the any plans/workarounds to support this in Pulumi? Or if anyone has any guidance on how I can proceed- do I provision just my task definition etc. via pulumi, and then use
@pulumi/command
to run a
aws deploy
?
g
This is pretty tricky, I am not aware of any ready-made solution, of wiring aws code-deploy and ecs/fargate. your best bets are: • look at aws native pulumi package • google search https://www.google.com/search?q=terraform+ecs+blue+green&oq=terraform+ecs+bl&gs_lcrp=EgZjaHJvbWUqBwgAEAAYgAQyBwgAEAAYgAQyBggBEEUYOTIICAIQABgWGB4yCAgDEAAYFhgeMggIBBAAGBYYHjIICAUQABgWGB4yCAgGEAAYFhgeMg0IBxAAGIYDGIAEGIoFMg0ICBAAGIYDGIAEGIoFMgoICRAAGIAEGKIE0gEIMzI4OWowajSoAgCwAgE&sourceid=chrome&ie=UTF-8 • inspect CDK L2 construct code and try to imitate it. perhaps the integration of
@pulumi/command
can help https://dev.to/aws-builders/ecs-bluegreen-deployment-with-codedeploy-and-terraform-3gf1