# Pushing to ECS with updated image tag

**URL:** <https://community.codefresh.io/t/pushing-to-ecs-with-updated-image-tag/726>\
**Category:** Pipeline Workflows\
**Created:** [February 8, 2022, 11:55am UTC](https://community.codefresh.io/t/pushing-to-ecs-with-updated-image-tag/726 "2022-02-08T11:55:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nk9](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/nk9/32/465_2.png) [@nk9](https://community.codefresh.io/u/nk9)\
**Post date:** [February 8, 2022, 11:55am UTC](https://community.codefresh.io/t/pushing-to-ecs-with-updated-image-tag/726/1 "2022-02-08T11:55:23Z")

</div>

I want my pipeline to fetch code from GitHub, create a Docker image, push it to ECR with a tag, and then deploy this new image on ECS (Fargate). It seems like this should be the simplest thing in the world, but I cannot figure out how to do it.

The problem right now is that the task definition isn’t being modified to use the new tag created in the build step. I would expect the `ecs-deploy` step to take an image argument but it does not. I have found [the code for `cfecs-update`](https://github.com/codefresh-io/steps/blob/master/incubating/ecs-deploy/cfecs-update) which says I should be able to pass an `--image-tag` argument to the script, so I have tried this:

```auto
  deploy_staging:
    title: "Deploy to ECS staging environment"
    type: ecs-deploy
    commands:
      - cfecs-update --image-tag ${{CF_SHORT_REVISION}} us-east-2 my-cluster my-service
    arguments:
      aws-region: '${{AWS_DEFAULT_REGION}}'
      region: '${{AWS_DEFAULT_REGION}}'
      AWS_ACCESS_KEY_ID: '${{AWS_ACCESS_KEY_ID}}'
      AWS_SECRET_ACCESS_KEY: '${{AWS_SECRET_ACCESS_KEY}}'
      cluster_name: "my-cluster"
      service_name: "my-service"

```

But when this runs, I see this in the console:

```auto
Updating Service: cluster = my-cluster , service = my-service
{ 'deploy_timeout': 900,                                                                                                               
    'image_name': None,                                                                                                                  
    'image_tag': None,                                                                                                                   
    'max_failed': 2,                                                                                                                     
    'region_name': 'us-east-2',                                                                                                          
    'wait': True}  

```

So it looks like the image\_tag isn’t actually being passed along. And indeed, the newest version of the task definition uses the same image URL as the old version.

How can I specify the image tag which Codefresh should deploy using ECS?

---

<div class="post-metadata">

**Author:** ![Kostis](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/kostis/32/391_2.png) [@Kostis](https://community.codefresh.io/u/Kostis)\
**Post date:** [February 10, 2022, 1:09pm UTC](https://community.codefresh.io/t/pushing-to-ecs-with-updated-image-tag/726/2 "2022-02-10T13:09:13Z")

</div>

Looking at the docs at [Amazon ECS/Fargate · Codefresh | Docs](https://codefresh.io/docs/docs/yaml-examples/examples/amazon-ecs/#content) I think you need to pass 2 arguments (image name AND image tag)

If that doesn’t work, then please open an issue with us so that our support team can investigate

---

<div class="post-metadata">

**Author:** ![nk9](https://sea1.discourse-cdn.com/flex019/user_avatar/community.codefresh.io/nk9/32/465_2.png) [@nk9](https://community.codefresh.io/u/nk9)\
**Post date:** [February 11, 2022, 3:52pm UTC](https://community.codefresh.io/t/pushing-to-ecs-with-updated-image-tag/726/3 "2022-02-11T15:52:10Z")

</div>

Thanks Kostis. I tried passing both the name and the tag, and that didn’t change anything.

I did open a ticket, and they informed me that the step I was using (`ecs-deploy`) doesn’t actually support passing the image tag. The solution, as you pointed out, was to use a freestyle step as described in the ECS/Fargate example using the `codefreshplugins/cf-deploy-ecs` image.

I’ve [filed a bug](https://github.com/codefresh-io/steps/issues/441) about this step’s image tag problem, and I hope you can fix it soon. I can’t actaully figure out how this step can be of any use in a build pipeline, if there’s no way to point the step at the image that has just been built!
