title: How to use previous task definition with ECS and bitbucket pipeline deployment
body: <p>I'm following this doc <a href="https://confluence.atlassian.com/bitbucket/deploy-to-amazon-ecs-892623902.html" rel="nofollow noreferrer">https://confluence.atlassian.com/bitbucket/deploy-to-amazon-ecs-892623902.html</a> to set up a pipeline to deploy to the ECS cluster.</p>
  
  <p>This doc is using a custom task def JSON file and using the same for the deployment after updating the image name.</p>
  
  <p>Am I required to copy the complete task definition JSON and put that in my repository? My task definition has lots of environment variables in it. I do not want to expose them by putting it in the repository.</p>
  
  <p>Or, the task definition template will update the default task definition and create a new revision. (not overwrite)</p>
  
  <p>The deployment step is</p>
  
  <pre><code>tags:
      revision-*:
         - step:
            deployment: production
            name: Deploy to ECS
            script:
              # Replace the docker image name in the task definition with the newly pushed image.
              - export IMAGE_NAME=${ECR_USERNAME}/${BITBUCKET_REPO_SLUG}:latest
  
              - envsubst &lt; task-definition-template.json &gt;  task-definition.json
  
              # Update the task definition.
              - pipe: atlassian/aws-ecs-deploy:1.0.0
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  CLUSTER_NAME: $AWS_ECS_CLUSTER_NAME
                  SERVICE_NAME: $AWS_ECS_SERVICE_NAME
                  TASK_DEFINITION: 'task-definition.json'
  
  </code></pre>
  
  <p>It is expecting me to have a definition file in my repository <code>task-definition-template.json</code></p>
  
  <p>How can I use the predefined tasks instead of using the JSON file? Also, where can I find more doc about the pipe. </p>
  
  <pre><code>atlassian/aws-ecs-deploy
  </code></pre>