Search code examples
amazon-web-servicesaws-sdkaws-cliamazon-kmsaws-ssm

AWS SSM Parameters Store


Is there anyway to just nuke / remove all items in AWS Parameters Store?

All the command line I found are to remove it either one by one or remove it given a list of names.

I also tried using

aws ssm delete-parameters --cli-input-json test.json

with test.json file looks like this

{
    "Names": [
        "test1",
        "test2"
    ]
}

still does not work..

Ideally if I can use --query and use it as is, that'd be great.

I'm using --query like so

aws ssm get-parameters-by-path --path / --max-items 2 --query 'Parameters[*].[Name]'

Solution

  • You can combine get-parameters-by-path with delete-parameters:

    aws ssm delete-parameters --names `aws ssm get-parameters-by-path --path / --query Parameters[].Name --output text`
    

    I tested it by creating two parameters, then running the above command. It successfully deleted by parameters.