Adding Cloudwatch Logging to CircleCI Container Build

I am attempting to set up a pipeline where a simple website is built and then deployed to AWS ECS – Fargate using CircleCI. Currently, the docker image builds, the image is stored in ECR, and then the tasks run in ECS using Fargate.

However, when I try to hit the public IP, I just get to a nginx proxy page instead of the apache webserver. I can pull the image from ECR to get build a container, but I would like the get the logs for Fargate and the tasks to be sent to CloudWatch. There are no ECS Instances running, so I can’t configure anything.

I suspect that I need to add some commands to CircleCI to allow logging, but I can’t seem to find the way to do that. My CircleCI configuration uses the AWS orbs.

orbs:
  aws-ecr: circleci/[email protected]
  aws-ecs: circleci/[email protected]
workflows:
  build-and-deploy:
    jobs:
        - build
        - aws-ecr/build_and_push_image:
              requires:
                - build
              attach-workspace: true
              workspace-root: .
              account-url: AWS_ACCOUNT_URL
              repo: "${AWS_RESOURCE_NAME_PREFIX}"
              region: AWS_DEFAULT_REGION
              tag: "${CIRCLE_SHA1}"
        - aws-ecs/deploy-service-update:
              requires:
                - aws-ecr/build_and_push_image
              aws-region: ${AWS_DEFAULT_REGION}
              family: "${AWS_RESOURCE_NAME_PREFIX}-service"
              cluster-name: "${AWS_RESOURCE_NAME_PREFIX}-cluster"
              container-image-name-updates: "container=${AWS_RESOURCE_NAME_PREFIX}-service,tag=${CIRCLE_SHA1}"
              filters:
                  branches:
                      only:
                          - master

Source: StackOverflow