← 返回命令列表

Linux command

aws-ssm 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List managed instances

aws ssm describe-instance-information

Start a Session Manager session

aws ssm start-session --target [i-xxxxxxxxxxxxxxxx]

Run a command

aws ssm send-command --document-name "AWS-RunShellScript" --targets "Key=instanceids,Values=[i-xxxxxxxx]" --parameters 'commands=["echo hello"]'

Get parameter

aws ssm get-parameter --name [/path/to/parameter]

Get parameter with decryption

aws ssm get-parameter --name [/path/to/secret] --with-decryption

Put a parameter

aws ssm put-parameter --name [/path/to/parameter] --value "[value]" --type String

List parameters

aws ssm get-parameters-by-path --path [/path/prefix/] --recursive

List command invocations

aws ssm list-command-invocations --command-id [command-id] --details

说明

aws ssm is a subcommand of the AWS CLI that manages AWS Systems Manager, a service for operational management of AWS resources. SSM provides capabilities for instance management, configuration, patching, and secure parameter storage. Session Manager enables secure shell access to EC2 instances without SSH keys or open inbound ports. It logs sessions and supports IAM-based access control. Run Command executes scripts and commands across fleets of instances without SSH. Parameter Store provides hierarchical storage for configuration data and secrets with optional encryption. The SSM Agent must be installed on instances for most operations. It comes pre-installed on many AWS AMIs.

参数

describe-instance-information
List instances managed by SSM.
start-session
Start interactive Session Manager session.
send-command
Execute a command on targets.
list-commands
List command history.
list-command-invocations
Get command execution results.
get-parameter
Retrieve a parameter value.
put-parameter
Create or update a parameter.
get-parameters-by-path
List parameters under a path.
delete-parameter
Remove a parameter.
get-document
Get SSM document contents.
describe-document
Get SSM document details.
list-documents
List available SSM documents.
describe-patches
List information about patches.
--target _instance-id_
Target instance for session.
--document-name _name_
SSM document to execute.
--targets _targets_
Target instances for commands.
--parameters _params_
Document parameters.
--name _name_
Parameter name (hierarchical path).
--value _value_
Parameter value.
--type _type_
Parameter type: String, StringList, SecureString.
--with-decryption
Decrypt SecureString parameters.
--overwrite
Overwrite existing parameter value.
--recursive
Retrieve parameters recursively by path.

FAQ

What is the aws-ssm command used for?

aws ssm is a subcommand of the AWS CLI that manages AWS Systems Manager, a service for operational management of AWS resources. SSM provides capabilities for instance management, configuration, patching, and secure parameter storage. Session Manager enables secure shell access to EC2 instances without SSH keys or open inbound ports. It logs sessions and supports IAM-based access control. Run Command executes scripts and commands across fleets of instances without SSH. Parameter Store provides hierarchical storage for configuration data and secrets with optional encryption. The SSM Agent must be installed on instances for most operations. It comes pre-installed on many AWS AMIs.

How do I run a basic aws-ssm example?

Run `aws ssm describe-instance-information` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does describe-instance-information do in aws-ssm?

List instances managed by SSM.