SetImageStatus
Sets the status of an image in a premium repository to ACTIVE or
DEPRECATED. When you deprecate an image, Amazon ECR deletes it after the
deprecation period ends. You can't use this operation while the repository is in the
DRAFT state.
Request Syntax
{
"deprecationPeriodDays": number,
"imageId": {
"imageDigest": "string",
"imageTag": "string"
},
"registryId": "string",
"repositoryName": "string",
"repositoryType": "string",
"status": "string"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- deprecationPeriodDays
-
The number of days that Amazon ECR waits before it deletes the deprecated image. You can specify a value between 90 and 365. This parameter is required when you set
statustoDEPRECATED. Don't specify it when you setstatustoACTIVE.Type: Integer
Valid Range: Minimum value of 90. Maximum value of 365.
Required: No
- imageId
-
The image ID of the image to set the status for. If you specify a tag, the tag is resolved to the digest of the image that it currently points to, and the status is set on that image.
Type: ImageIdentifier object
Required: Yes
- registryId
-
The AWS account ID that's associated with the public registry that contains the image. If you do not specify a registry, the default public registry is assumed. You can specify only your own account ID. Cross-account access through a repository policy isn't supported for this operation.
Type: String
Pattern:
[0-9]{12}Required: No
- repositoryName
-
The name of the repository that contains the image.
Type: String
Length Constraints: Minimum length of 2. Maximum length of 205.
Pattern:
[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*Required: Yes
- repositoryType
-
The type of the repository. You can set the image status only in a
PREMIUMrepository.Type: String
Valid Values:
FREE | PREMIUMRequired: Yes
- status
-
The status to set on the image. Valid values:
-
ACTIVE: Cancels a pending deletion. You can do this only before the scheduled deletion time. -
DEPRECATED: Schedules the image for deletion after the deprecation period.
After the scheduled deletion time, you can't change the status of the image.
If the image is part of a manifest list, Amazon ECR requires that a manifest list is deleted before the images that it references. To deprecate an image that a manifest list references, deprecate the manifest list first, with a scheduled deletion time before the image's. You can't set a manifest list to
ACTIVEwhile it references deprecated images. Requests that break these rules fail withValidationException.Type: String
Valid Values:
ACTIVE | DEPRECATEDRequired: Yes
-
Response Syntax
{
"imageId": {
"imageDigest": "string",
"imageTag": "string"
},
"repositoryName": "string",
"repositoryType": "string",
"scheduledDeletionAt": number,
"status": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- imageId
-
The image ID of the image that the status was set on.
Type: ImageIdentifier object
- repositoryName
-
The repository name that's associated with the request.
Type: String
Length Constraints: Minimum length of 2. Maximum length of 205.
Pattern:
[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)* - repositoryType
-
The type of the repository.
Type: String
Valid Values:
FREE | PREMIUM - scheduledDeletionAt
-
The date and time that the deprecated image is scheduled for deletion. This is the time of the
SetImageStatusrequest plus the deprecation period. Amazon ECR deletes the image within 24 hours after this time. Amazon ECR returns this value only when the image status isDEPRECATED.Type: Timestamp
- status
-
The status of the image. Valid values:
-
ACTIVE: The image isn't scheduled for deletion. -
DEPRECATED: The image is scheduled for deletion. Entitled buyers can still pull it until it's deleted.
Type: String
Valid Values:
ACTIVE | DEPRECATED -
Errors
For information about the errors that are common to all actions, see Common Error Types.
- ConflictException
-
Another operation is in progress on the same resource. Wait and then retry the request.
- message
-
The error message associated with the exception.
HTTP Status Code: 400
- ImageNotFoundException
-
The image requested doesn't exist in the specified repository. Check the image tag or digest. To list the images in a repository, use
DescribeImagesorDescribeImageTags, or for a premium repository that you're entitled to,DescribeEntitledImagesorDescribeEntitledImageTags.- message
-
The error message associated with the exception.
HTTP Status Code: 400
- InvalidParameterException
-
The specified parameter is invalid. Review the available parameters for the API request.
- message
-
The error message associated with the exception.
HTTP Status Code: 400
- RepositoryNotFoundException
-
The specified repository can't be found. Check the spelling of the specified repository and ensure that you're performing operations on the correct registry.
- message
-
The error message associated with the exception.
HTTP Status Code: 400
- ServerException
-
These errors are usually caused by a server-side issue. Retry the request. If it continues to fail, contact AWS Support.
- message
-
The error message associated with the exception.
HTTP Status Code: 500
- UnsupportedCommandException
-
The action isn't supported in this Region. Check that the action is available in the AWS Region that you're using, and try again in a supported Region.
- message
-
The error message associated with the exception.
HTTP Status Code: 400
- ValidationException
-
There was an error validating the request. Check the request parameters and try again.
- message
-
The error message associated with the exception.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: