Prajwal Iyer
Prajwal Iyer

Reputation: 11

Cannot find a definition for command named aws-ecs/deploy_service_update in CircleCI config.yml for Docker AWS ECR ECS setup

In CircleCI, I am trying to build my Docker image and push it to AWS ECR and then deploy with AWS ECS. However, for the AWS ECS part, I am getting an error in CircleCI:

Error: config compilation contains errors: config compilation contains errors:
        - Error calling workflow: 'build_deploy_prod'
        - Error calling job: 'deploy-to-ecs'
        - Cannot find a definition for command named aws-ecs/deploy_service_update

I find that the AWS ECR part does not have any problems and is working correctly, however I get this error only for the AWS ECS deploy_service_update.

Here is the code for my CircleCI config.yml:

version: 2.1

orbs:
  aws-cli: circleci/[email protected]
  aws-ecr: circleci/[email protected]
  aws-ecs: circleci/[email protected]

executors:
  pod-php:
    docker:
      - image: circleci/php:7.4-node
      - image: tkuchiki/delayed-mysql
        environment:
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
          MYSQL_ROOT_PASSWORD: ''
          MYSQL_DATABASE: pod_test
    working_directory: [REDACTED]
    environment:
      CIRCLE_ARTIFACTS: /tmp/circleci-artfacts
      CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
      DEBIAN_FRONTEND: noninteractive

jobs:
  
  build-and-push-docker:
    docker:
      - image: cimg/php:7.4-node
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: |
            composer install --no-interaction --prefer-dist
            npm install
      - run:
          name: Build application
          command: |
            npm run production
      - setup_remote_docker:
          version: 20.10.14
      # Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_ECR_ACCOUNT_URL
      - aws-ecr/build_and_push_image:
          auth:
            - aws-cli/setup:
                role_arn: arn:aws:iam::[REDACTED]
          repo: [REDACTED]
          tag: "latest, v0.1.${CIRCLE_BUILD_NUM}"
          dockerfile: Dockerfile

  deploy-to-ecs:
    docker:
      - image: cimg/base:stable
    steps:
      - aws-ecs/deploy_service_update:
          auth:
            - aws-cli/setup:
                role_arn: arn:aws:iam::[REDACTED]
          cluster: ${ECS_CLUSTER_NAME}
          container_image_name_updates: container=${ECS_SERVICE_NAME},tag=${CIRCLE_SHA1}
          family: ${ECS_SERVICE_NAME}
          
workflows:
  version: 2.1
  build_deploy_prod:
    jobs:
      - test:
          context: "prod"
          filters:
            branches:
              only:
                - master
      - build-and-push-docker:
          context: "prod"
          requires:
            - test
          filters:
            branches:
              only:
                - master
      - deploy-to-ecs:
          context: "prod"
          requires:
            - build-and-push-docker
          filters:
            branches:
              only:
                - master

I have tried the service name with both hyphens and underscores. I tried to set it up using the documentation on CircleCI website:

Upvotes: 0

Views: 155

Answers (1)

yaningo
yaningo

Reputation: 523

Look at the list of commands for the [email protected] orb. None of them is called "deploy_service_update".

The "deploy_service_update" you see in the orb's documentation is how that specific usage example was named.

Upvotes: 0

Related Questions