Pipe file directly to AWS SSM parameter store?

aws ssm get-parameter value only
aws ssm put-parameter
aws:ssm cli
aws parameter store console
ssm get parameter version
aws cli parameters
aws ssm copy parameter
confd aws parameter store

Just curious on how do i pipe file directly to aws ssm parameter store? e.g.

# Put into ssm parameter store
cat my_github_private.key | aws ssm put-parameter --region ap-southeast-1 --name MY_GITHUB_PRIVATE_KEY --type SecureString --key-id alias/aws/ssm --value ??? 
# And read it back 
aws ssm get-parameter --region ap-southeast-1 --name MY_GITHUB_PRIVATE_KEY --with-decryption --query Parameter.Value --output text > my_github_private.key.1
# Two should be identical
diff my_github_private.key my_github_private.key.1

Rather than taking the value from stdin can you directly add to the command line arguments?

aws ssm put-parameter \
    --region ap-southeast-1 \
    --name MY_GITHUB_PRIVATE_KEY \
    --type SecureString \
    --key-id alias/aws/ssm \
    --value "$(cat my_github_private.key)"

Tips and tricks for AWS SSM Parameter Store with confd, SSM parameter store is a service from AWS which allows you to manage In both cases the output will tell us the version of the parameter. To compose files with confd you'll need to create a resource config and a template  Use Parameter Store parameters with other Systems Manager capabilities and AWS services to retrieve secrets and configuration data from a central store. Parameters work with Systems Manager capabilities such as Run Command, State Manager, and Automation.

IF you are using terraform:

data "local_file" "yourkeyfile" {
    filename = "keys/yourkey.pem"
}
resource "aws_ssm_parameter" "aresource-name-for-your-key" {
  name  = "/the/ssm/key"
  type  = "SecureString"
  value = "${data.local_file.yourkeyfile.content}"
}

Remember to crypt yourkey.pem for example using blackbox

get-parameters-by-path, AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. Retrieve information about one or more parameters in a specific hierarchy. When using --output text and the --query argument on a paginated response, the An Systems Manager parameter in Parameter Store. Using AWS Identity and Access Management (IAM) policies, you can provide or restrict user access to Parameter Store API actions and content. In the following sample policy, users are first granted access to run the PutParameter API action on all parameters in the AWS account 123456789012 in the US East (Ohio) Region (us-east-2).

@tkwargs, how to get only value from key.json file and example

aws ssm put-parameter \
    --region ap-southeast-1 \
    --name MY_GITHUB_PRIVATE_KEY \
    --type SecureString \
    --key-id alias/aws/ssm \
    --value "$(cat my_github_private.json file and get value only)"

get-parameters, AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. --generate-cli-skeleton (string) Prints a JSON skeleton to standard output An Systems Manager parameter in Parameter Store. The specified parameter version was not found. Verify the parameter name and version, and try again. HTTP Status Code: 400

put-parameter, arn:aws:ssm:us-east-2:111122223333:parameter/ExampleParameterName Parameter Store offers a standard tier and an advanced tier for parameters. If provided with the value output, it validates the command inputs and returns a  aws kms describe-key --key-id alias/aws/ssm. To create a standard secure string parameter, use the PutParameter operation in the Systems Manager API. Omit the Tier parameter or specify a value of Standard, which is the default.

Walkthrough: Use the AWS CLI with Run Command, The output of the following command shows if instances are online. on Linux Instance" --parameters commands=whoami --output text --query "Command. After you create the content for your custom SSM document, as described in , you can use the AWS CLI or AWS Tools for PowerShell to create an SSM document using your content. This is shown in the following command.

Walkthrough: Create and update a String parameter (AWS CLI , The following procedure walks you through the process of creating and storing a parameter of the type String using the AWS CLI. Systems Manager Parameter Store is a managed service (part of AWS EC2 Systems Manager (SSM)) that provides a convenient way to efficiently and securely get and set commonly used configuration data across multiple resources in your software delivery lifecycle. In this post, we will be focusing on the basic usage of Parameter Store and how Read more

Comments
  • Another response from Github [aws-cli repo] (github.com/aws/aws-cli/issues/3132): aws ssm put-parameter \ --region ap-southeast-1 \ --name MY_GITHUB_PRIVATE_KEY \ --type SecureString \ --key-id alias/aws/ssm \ --value file://path/to/my_github_private.key Both of them work. Thanks guys.
  • finally got the value using jq -r '.private_key' , aws ssm put-parameter \ --region ap-southeast-1 \ --name MY_GITHUB_PRIVATE_KEY \ --type SecureString \ --key-id alias/aws/ssm \ --value "$(cat my_github_private.json | jq -r '.value.key')"