Deploy to ECR / ECS


I am trying to follow along with this tutorial:

Can anyone advise on what a suitable IAM policy would be to accompany this tutorial? I have started with a blank policy and adding permissions as it goes along and fails… but hoping someone else has done this already so that I can speed things up a little.


I couldn’t find anyone willing to post a policy anywhere on the internet either, so I had to fault through building my own. The ECR part is based on AmazonEC2ContainerRegistryPowerUser with the get image stuff stripped out. The ECS part is the bare minimum based on faulting through an actual deployment. The policy is wrapped in a Terraform resource, for the benefit of anyone using that.

resource "aws_iam_policy" "ecr-ecs-deployment" {
    name        = "ecr-ecs-deployment"
    path        = "/"
    description = "Allows writing new images to ECR and updating an existing ECS service task"
    policy      = <<POLICY
  "Version": "2012-10-17",
  "Statement": [
      "Effect": "Allow",
      "Action": [
      "Resource": "*"