Aws-ecr/build-and-push-image specify resource class

Hi,
I am using the aws-ecr/build-and-push-image orb to build docker images and push them to AWS ECR.
I’m using a medium machine to do the work. I’d like to try and increase that to a faster machine type.
Is this possible? I’ve tried numerous options in my config file but I am struggling to get the right syntax. Perhaps it is not possible with this orb…

thanks

Hi @p3d,

Thank you for sharing your question on our forum!

With the aws-ecr/build-and-push-image job, you can pass in a custom executor and define a specific resource class.

Here is an example config.yml:

version: 2.1

orbs: 
  aws-ecr: circleci/aws-ecr@7.3.0
  
executors:
  custom:
    machine:
      image: ubuntu-2004:202111-02
    resource_class: large

workflows:
  workflow1:
    jobs:
      - aws-ecr/build-and-push-image:
          executor: custom
          repo: testrepo

Here I have defined an executor named custom, and I am passing that in to the orb job under the executor parameter. You will also need to specify an image. A list of available images for the machine executor is available here:

Configuring CircleCI - CircleCI

For reference, the default executor has the following definition:

machine:
  docker_layer_caching: <<parameters.use-docker-layer-caching>>
  image: <<parameters.image>>
parameters:
  image:
    default: 'ubuntu-2004:202010-01'
    type: string
  resource-class:
    default: medium
    type: string
  use-docker-layer-caching:
    default: false
    type: boolean
resource_class: <<parameters.resource-class>>

Let me know if you would like further clarification on anything.