Pages

Wednesday, July 5, 2023

AWS CLI SSM Delete with overwrite

 Usually we cannot replace / edit the name of the SSM Parameter. so if you delete the parameter, then for next 7 days we can't create new parameter with the same name.

Solution:

    We need to delete the SSM Parameter with the help CLI and then we can delete in the console


aws secretsmanager delete-secret --secret-id /DOS/CICD/SSMNAME --force-delete-without-recovery --region eu-west-1

{

    "ARN": "arn:aws:secretsmanager:eu-west-1:0000000000:secret:/DOS/CICD/SSMNAME-0ApOvK",

    "Name": "/DOS/CICD/SSMNAME",

    "DeletionDate": 1688618796.092

}

Then we can come back to AWS Console and delete the parameter graphically and then we are allowed immediately to create parameter with same name.


Useful Commands:

To describe / list the SSM Parameters for this AWS Account

    aws ssm describe-parameters --region=eu-west-1


To convert the SSM from string to Securestring

    aws ssm put-parameter --name /DOS/CICD/SSMNAME --value "NEW" --type "SecureString" --overwrite --region=eu-west-1

If the new value is short we can directly mention here if its huge or complicated then just mention NEW/some small word,Then we can go AWS Console and replace it with proper values.


No comments:

Post a Comment