List all parameters in AWS SSM Parameter Store - amazon-web-services

How do I list all parameters in the AWS Systems Manager (SSM) Parameter Store? I am using the AWS CLI.
I can store them with aws ssm put-parameter. I can fetch them with aws ssm get-parameter. I can list all documents with aws ssm list-documents, but I do not see a corresponding list-parameters function.

I think what you want is
aws ssm describe-parameters
docs

You are looking for describe-parameters.

If you need to list parameters' name and know the path you could use the following:
aws ssm get-parameters-by-path \
--path "/my-common-path" \
--recursive \
--query "Parameters[*].Name"

Related

Rest api to get all details of AWS marketplace public listing

Is there any Rest api to get all details(including the AMI image details) of AWS marketplace public listing?
For Example:-
https://aws.amazon.com/marketplace/pp/prodview-lk3liabqn4x2i?sr=0-1&ref_=beagle&applicationId=AWSMPContessa
I want all details if I provide any identifier from the URL.
Yes, you can use the EC2 API DescribeImages action and set the Owner parameter to aws-marketplace to output all the AWS Marketplace-owned AMIs and their details in a specific region.
Here is an example AWS CLI command that does that:
aws ec2 describe-images \
--region us-east-1 \
--owners aws-marketplace
With AWS CLI, you can also use filtering to filter the list.

Is it possible to update a parameter in AWS SSM parameter store from an SSM Command?

As per a requirement, we want to store a parameter in SSM parameter store, and one should be able to update the parameter value through an SSM command.
From the initial research it is understood that we can run the SSM commands on Target EC2 instances. However not able to find a way to run the command with target as Parameter store. Please help.
To read values to or from ssm parameter store you can use the aws cli.
For that to work you need to set it up:
https://docs.aws.amazon.com/de_de/cli/latest/userguide/install-cliv2.html
You will need to create an aws access key and an aws secret key, if you not already have that.
After you have configured your aws cli like that:
$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: eu-central-1
Default output format [None]: json
You should be able to execute this command to check if it works:
$ aws sts get-caller-identity
To store a value in ssm this command will work:
$ aws ssm put-parameter --name "test123" --type "String" --value "MyValue"
{
"Version": 1,
"Tier": "Standard"
}
To read that parameter from ssm use this:
$ aws ssm get-parameter --name "test123" --query Parameter.Value
"MyValue"

aws-cli only return certain fields

Given this example of aws-cli command
aws rds describe-db-cluster-snapshots
I returns a list of objects with fields.
I only want to display the fields: "SnapshotCreateTime" and "DBClusterIdentifier"
How do I do this?
AWS CLI provides built-in output filtering capabilities with the --query option.
aws rds describe-db-cluster-snapshots --query 'DBClusterSnapshots[*].[SnapshotCreateTime,DBClusterIdentifier]'
The above will work if your AWS CLI configured in the same region and have single AWS CLI profile. If AWS CLI configured in a different region and different profile then you can use below command.
aws rds describe-db-cluster-snapshots --query 'DBClusterSnapshots[*].[SnapshotCreateTime,DBClusterIdentifier]' --region us-west-2 --profile test
cli-usage-output

AWS CLI SSM get-parameters InvalidParameters on Windows

I'm using
GitBash v2.17.0
AWS CLI v1.16.67
Windows 10
Problem
I've created a SecureString parameter in the AWS SSM Parameter Store. For sake of example, let's call the parameter
/levelOne/levelTwo
I'm trying to retrieve the parameter using the AWS CLI. To do this I am using the following command:
aws ssm get-parameters --names '/levelOne/LevelTwo' --with-decryption
The problem is that the result returned is this:
As you can see, the parameter is being prefixed with C:/Program Files/Git.
Can anyone explain what I have done wrong please?
Thanks
This is caused by POSIX path conversion in MinGW.
You can work around this by substituting // for the leading /, and then replacing the subsequent forward slashes with backslashes, e.g.
aws ssm get-parameters --names '//levelOne\levelTwo'
This command will only run correctly in MinGW, i.e. it will fail in Bash or Windows CMD.
I faced the same issue.
Check the region selected while you create the parameter store from the console.
The reason for this is that Aws-ssm is regional service.
aws ssm get-parameters --names "/levelOne/LevelTwo" --region us-west-1 --with-decryption
i got it working by adding a space in front of the names parameter value. To get it working os independent.
aws ssm get-parameters --names " /levelOne/LevelTwo" --with-decryption

Where to find Endpoint in creating aws-cli bots without using amazon-lex?

I'm trying to create a chatbot using aws-cli .Going through the Steps in Documentation in https://docs.aws.amazon.com/lex/latest/dg/gs-create-flower-types.html
I couldn't understand what endpoint did it mean in the documentation as shown in the syntax.
aws lex-models put-slot-type \
--region region \
--endpoint endpoint \
--name FlowerTypes \
--cli-input-json file://FlowerTypes.json
What is the endpoint in the above syntax?
You can find the list of endpoints for Lex at this link
For your current case, https://models.lex.us-east-1.amazonaws.com/ will work as endpoint, given that your region is us-east-1.
Below code will work if you are using Windows machine:
aws lex-models put-slot-type ^
--region us-east-1 ^
--endpoint https://models.lex.us-east-1.amazonaws.com/ ^
--name FlowerTypes ^
--cli-input-json file://FlowerTypes.json
Keep the input json file in the same folder where you have opened the CLI.