---
title: "POST /#X-Amz-Target=AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy"
method: POST
path: "/#X-Amz-Target=AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy"
---

# POST /#X-Amz-Target=AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy

`POST /#X-Amz-Target=AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy`

Creates or updates the lifecycle policy for the specified repository. For more information, see <a href="https://docs.aws.amazon.com/AmazonECR/latest/userguide/LifecyclePolicies.html">Lifecycle policy template</a>.

## Headers

- `X-Amz-Target` 'AmazonEC2ContainerRegistry_V20150921.PutLifecyclePolicy', required

## Request body

- PutLifecyclePolicyRequest
  - `registryId` string — The Amazon Web Services account ID associated with the registry that contains the repository. If you do&#x2028; not specify a registry, the default registry is assumed.
  - `repositoryName` string, required — The name of the repository to receive the policy.
  - `lifecyclePolicyText` string, required — The JSON repository policy text to apply to the repository.

## Response `200`

Success

- PutLifecyclePolicyResponse
  - `registryId` string — The registry ID associated with the request.
  - `repositoryName` string — The repository name associated with the request.
  - `lifecyclePolicyText` string — The JSON repository policy text.

## Other responses

- `480` — ServerException
- `481` — InvalidParameterException
- `482` — RepositoryNotFoundException

---

[API](https://skmtc.net/aws/apis/ecr.md) · [All operations](https://skmtc.net/aws/apis/ecr/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/ecr/versions/965cbb14e137/schema)
