CmdID

CmdID / aws / aws secretsmanager

aws secretsmanager update-secret-version-stage

Modifies the staging labels attached to a version of a secret. AWS CLI reference

3 examples 4 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To revert a secret to the previous version

The following update-secret-version-stage example moves the AWSCURRENT staging label to the previous version of a secret, which reverts the secret to the previous version. To find the ID for the previous version, use list-secret-version-ids. For this example, the version with the AWSCURRENT label is a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 and the version with the AWSPREVIOUS label is a1b2c3d4-5678-90ab-cdef-EXAMPLE22222. In this example, you move the AWSCURRENT label from version 11111 to 22222. Because the AWSCURRENT label is removed from a version, update-secret-version-stage automatically moves the AWSPREVIOUS label to that version (11111). The effect is that the AWSCURRENT and AWSPREVIOUS versions are swapped.

aws secretsmanager update-secret-version-stage --secret-id MyTestSecret --version-stage AWSCURRENT --move-to-version-id a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 --remove-from-version-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Identify
--secret-idThe ARN or the name of the secret with the version and staging labelsto modify.
--version-stageThe staging label to add to this version.
--move-to-version-idThe ID of the version to add the staging label to.
--remove-from-version-idThe ID of the version that the staging label is to be removed from.
Its output
{
    "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-a1b2c3",
    "Name": "MyTestSecret"
}

For more information, see What's in a Secrets Manager secret? in the Secrets Manager User Guide.

Example 2: To add a staging label attached to a version of a secret

The following update-secret-version-stage example adds a staging label to a version of a secret. You can review the results by running list-secret-version-ids and viewing the VersionStages response field for the affected version.

aws secretsmanager update-secret-version-stage --secret-id MyTestSecret --version-stage STAGINGLABEL1 --move-to-version-id a1b2c3d4-5678-90ab-cdef-EXAMPLE33333Identify
--secret-idThe ARN or the name of the secret with the version and staging labelsto modify.
--version-stageThe staging label to add to this version.
--move-to-version-idThe ID of the version to add the staging label to.
Its output
{
    "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-a1b2c3",
    "Name": "MyTestSecret"
}

For more information, see What's in a Secrets Manager secret? in the Secrets Manager User Guide.

Example 3: To delete a staging label attached to a version of a secret

The following update-secret-version-stage example deletes a staging label that is attached to a version of a secret. You can review the results by running list-secret-version-ids and viewing the VersionStages response field for the affected version.

aws secretsmanager update-secret-version-stage --secret-id MyTestSecret --version-stage STAGINGLABEL1 --remove-from-version-id a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Identify
--secret-idThe ARN or the name of the secret with the version and staging labelsto modify.
--version-stageThe staging label to add to this version.
--remove-from-version-idThe ID of the version that the staging label is to be removed from.
Its output
{
    "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestSecret-a1b2c3",
    "Name": "MyTestSecret"
}

For more information, see What's in a Secrets Manager secret? in the Secrets Manager User Guide.

Options

4 in the AWS CLI reference
--move-to-version-idThe ID of the version to add the staging label to.
--remove-from-version-idThe ID of the version that the staging label is to be removed from.
--secret-idThe ARN or the name of the secret with the version and staging labelsto modify.
--version-stageThe staging label to add to this version.