https://github.com/jcoreio/aws-ecr-utils
utilities for working with AWS Elastic Container Registry
https://github.com/jcoreio/aws-ecr-utils
aws aws-sdk ecr
Last synced: 4 months ago
JSON representation
utilities for working with AWS Elastic Container Registry
- Host: GitHub
- URL: https://github.com/jcoreio/aws-ecr-utils
- Owner: jcoreio
- License: mit
- Created: 2022-02-07T23:33:16.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-12-05T19:26:48.000Z (6 months ago)
- Last Synced: 2025-12-09T08:12:03.464Z (6 months ago)
- Topics: aws, aws-sdk, ecr
- Language: TypeScript
- Size: 824 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# @jcoreio/aws-ecr-utils
[](https://circleci.com/gh/jcoreio/aws-ecr-utils)
[](https://codecov.io/gh/jcoreio/aws-ecr-utils)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://badge.fury.io/js/%40jcoreio%2Faws-ecr-utils)
# Table of Contents
- [@jcoreio/aws-ecr-utils](#jcoreioaws-ecr-utils)
- [Table of Contents](#table-of-contents)
- [`copyECRImage(options)`](#copyecrimageoptions)
- [Options](#options)
- [`options.from.imageUri`, `options.to.imageUri` (`string`, **required**)](#optionsfromimageuri-optionstoimageuri-string-required)
- [`options.from.ecr`, `options.to.ecr` (`AWS.ECR`, _optional_)](#optionsfromecr-optionstoecr-awsecr-optional)
- [`options.from.awsConfig`, `options.to.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsfromawsconfig-optionstoawsconfig-awsconfigurationoptions-optional)
- [Returns (`Promise`)](#returns-promisevoid)
- [`ecrImageExists(options)`](#ecrimageexistsoptions)
- [Options](#options-1)
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional)
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional)
- [`options.imageUri` (`string`, _optional_)](#optionsimageuri-string-optional)
- [`options.registryId` (`string`, _optional_)](#optionsregistryid-string-optional)
- [`options.repositoryName` (`string`, _optional_)](#optionsrepositoryname-string-optional)
- [`options.imageTag` (`string`, _optional_)](#optionsimagetag-string-optional)
- [Returns (`Promise`)](#returns-promiseboolean)
- [`loginToECR(options)`](#logintoecroptions)
- [Options](#options-2)
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional-1)
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional-1)
- [Returns (`Promise`)](#returns-promisevoid-1)
- [`parseECRImageUri(imageUri)`](#parseecrimageuriimageuri)
- [Options](#options-3)
- [`imageUri` (`string`, **required**)](#imageuri-string-required)
- [Returns (`object`)](#returns-object)
- [`tagECRImage(options)`](#tagecrimageoptions)
- [Options](#options-4)
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional-2)
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional-2)
- [`options.imageUri` (`string`, **required**)](#optionsimageuri-string-required)
- [`options.tags` (`string[]`, **required**)](#optionstags-string-required)
- [Returns (`Promise`)](#returns-promisevoid-2)
- [`upsertECRRepository(options)`](#upsertecrrepositoryoptions)
- [Options](#options-5)
- [`options.ecr` (`AWS.ECR`, _optional_)](#optionsecr-awsecr-optional-3)
- [`options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)](#optionsawsconfig-awsconfigurationoptions-optional-3)
- [`options.repositoryName` (`string`, **required**)](#optionsrepositoryname-string-required)
- [Returns (`Promise`)](#returns-promiseawsecrrepository)
## `copyECRImage(options)`
Copies an image between ECRs (potentially between accounts). Requires Docker to be installed and the `docker` command to be on your path.
### Options
#### `options.from.imageUri`, `options.to.imageUri` (`string`, **required**)
The URIs of the source and destination ECR images
#### `options.from.ecr`, `options.to.ecr` (`AWS.ECR`, _optional_)
The ECR clients to use for the source and destination images
#### `options.from.awsConfig`, `options.to.awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The AWS service options to use if `options.from.ecr` and `options.to.ecr` aren't provided
### Returns (`Promise`)
A promise that will resolve once the image has been pulled from the source repository and pushed to the destination repository.
## `ecrImageExists(options)`
Determines if an ECR image exists.
### Options
#### `options.ecr` (`AWS.ECR`, _optional_)
The ECR client to use
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The AWS service options to use if `options.ecr` isn't provided
#### `options.imageUri` (`string`, _optional_)
The URI of the image to look for. You must provide either this or `options.registryId`,
`options.repositoryName`, or `imageTag`.
#### `options.registryId` (`string`, _optional_)
The ID of the ECR (same as your AWS account number?)
#### `options.repositoryName` (`string`, _optional_)
The name of the ECR repository
#### `options.imageTag` (`string`, _optional_)
The ECR image tag
### Returns (`Promise`)
A promise that will resolve to true if the image exists and false otherwise.
## `loginToECR(options)`
Logs the local Docker client into the given ECR. Requires Docker to be installed and the `docker` command to be on your path.
### Options
#### `options.ecr` (`AWS.ECR`, _optional_)
The ECR client to use
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The AWS service options to use if `options.ecr` isn't provided
### Returns (`Promise`)
A promise that will resolve once logged in.
## `parseECRImageUri(imageUri)`
Parses the given ECR image URI.
### Options
#### `imageUri` (`string`, **required**)
The URI of the ECR image to parse.
### Returns (`object`)
An object with the following properties:
```ts
{
registryId: string
region: string
repositoryName: string
imageTag: string
}
```
## `tagECRImage(options)`
Adds additional tags to an existing ECR image.
### Options
#### `options.ecr` (`AWS.ECR`, _optional_)
The ECR client to use
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The AWS service options to use if `options.ecr` isn't provided
#### `options.imageUri` (`string`, **required**)
The URI of the ECR image to add tags to
#### `options.tags` (`string[]`, **required**)
The tags to add to the ECR image
### Returns (`Promise`)
A promise that will resolve once the tags have been added.
## `upsertECRRepository(options)`
Creates an ECR repository if it doesn't already exist.
### Options
#### `options.ecr` (`AWS.ECR`, _optional_)
The ECR client to use
#### `options.awsConfig` (`AWS.ConfigurationOptions`, _optional_)
The AWS service options to use if `options.ecr` isn't provided
#### `options.repositoryName` (`string`, **required**)
The name of the repository to upsert
### Returns (`Promise`)
The found or created ECR repository