Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Deploy to AWS ECS without Task Defintion

Pipe in Question:

https://support.atlassian.com/bitbucket-cloud/docs/deploy-to-amazon-ecs/

https://bitbucket.org/atlassian/aws-ecs-deploy/src/master/

Description:

I would like to be able to deploy to ECS without using a new task definition and instead using the FORCE_NEW_DEPLOYMENT option to update the service to pull the `:latest` image from ECR.

The amazon cli update-service command provides this functionality. See the note. I want to be able to run this command:

aws ecs update-service --cluster $CLUSTER_NAME --service $SERVICE_NAME --force-new-deployment

Our use case is that we have cloudformation templates in a repo hat manages our IFA (infrastructure as code) separate from the application code. Thus, we would prefer to maintain the Task Definition in the IFA repo. But if we want to use this pipe, then we need to maintain the Task Definition in the application code.

Problem:

Currently, the `TASK_DEFINITION` is required in order for the pipe to complete successfully. So this prevents us from using the FORCE_NEW_DEPLOYMENT only.

Solution:

I propose making the TASK_DEFINITION optional so that we can force a new deployment without the need of the task definition. 

Here's an example of how the yaml would look:

pipelines:
  branches:
    development:
      - step:
          name: Build and Push image to ECR
          script:
            - docker build -f Dockerfile.prod -t <value> .
            - pipe: atlassian/aws-ecr-push-image:1.2.1
              variables:
                   IMAGE_NAME: <value>
          services:
            - docker
          caches:
            - docker
      - step:
          name: Deploy to ECS
          script:
            - pipe: atlassian/aws-ecs-deploy:1.2.1
              variables:
                CLUSTER_NAME: <value>
                SERVICE_NAME: <value>
                FORCE_NEW_DEPLOYMENT: true

 

2 answers

1 accepted

1 vote
Answer accepted

Hi @Joshua Nordstrom ,

we have released the new version of the atlassian/aws-ecs-deploy:1.4.0 pipe with the TASK_DEFINITION variable optional.

In the Advanced examples of the README, you could find details:

If your updated Docker image uses the same tag as what is in the existing task definition for your service (for example, my_image:latest ), you do not need to create a new revision of your task definition. You can update the service using the FORCE_NEW_DEPLOYMENT option. The new tasks launched by the deployment pull the current image/tag combination from your repository when they start.

script:
  - pipe: atlassian/aws-ecs-deploy:1.4.0
    variables:
      AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
      AWS_DEFAULT_REGION: 'us-east-1'
      CLUSTER_NAME: 'my-ecs-cluster'
      SERVICE_NAME: 'my-ecs-service'
      FORCE_NEW_DEPLOYMENT: 'true'


Welcome to provide us with your feedback about the pipe.


Cheers,
Oleksandr

Woohoo!! Thank you for adding this functionality.

Like Oleksandr Kyrdan likes this

Hi, I tried exactly the same setting, but the docker image is not updated, anyone knows why?

0 votes

@Joshua Nordstrom thanks for raising a case!

We will discuss this change within a team.

I'll notify about updates.

Cheers, Galyna

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

323 views 3 14
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you