sh-4.2$ aws ssm describe-instance-information --query "InstanceInformationList[*]"
[
{
"IsLatestVersion": false,
"ComputerName": "ip-10-96-10-139.ec2.internal",
"PingStatus": "Online",
"InstanceId": "i-04986f2288531ac84",
"IPAddress": "10.96.10.139",
"ResourceType": "EC2Instance",
"AgentVersion": "3.0.1124.0",
"PlatformVersion": "2",
"PlatformName": "Amazon Linux",
"PlatformType": "Linux",
"LastPingDateTime": 1640425926.721
},
{
"IsLatestVersion": false,
"ComputerName": "ip-10-96-10-136.ec2.internal",
"PingStatus": "Online",
"InstanceId": "i-098d23c10539215d9",
"IPAddress": "10.96.10.136",
"ResourceType": "EC2Instance",
"AgentVersion": "2.3.662.0",
"PlatformVersion": "18.04",
"PlatformName": "Ubuntu",
"PlatformType": "Linux",
"LastPingDateTime": 1640425979.054
},
{
"IsLatestVersion": false,
"ComputerName": "ip-10-96-10-150.ec2.internal",
"PingStatus": "Online",
"InstanceId": "i-087610378d7bb2979",
"IPAddress": "10.96.10.150",
"ResourceType": "EC2Instance",
"AgentVersion": "3.0.1124.0",
"PlatformVersion": "2",
"PlatformName": "Amazon Linux",
"PlatformType": "Linux",
"LastPingDateTime": 1640425973.299
}
]
sh-4.2$ cd
sh-4.2$ aws ssm get-document --name "AmazonInspector-ManageAWSAgent" --output
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument --output: expected one argument
sh-4.2$ aws ssm get-document --name "AmazonInspector-ManageAWSAgent" --output text > AmazonInspector-ManageAWSAgent.doc
sh-4.2$ cat AmazonInspector-ManageAWSAgent.doc | less
sh-4.2$ trap 'printf "\n"' DEBUG
sh-4.2$ export PS1="\n[\u@\h \W] $ "
[ssm-user@ip-10-96-10-150 ~] $ aws ssm send-command --targets Key=tag:SecurityScan,Values=true \
> --document-name "AmazonInspector-ManageAWSAgent" \
> --query Command.CommandId \
> --output-s3-bucket-name qls-5241198-a9ddb2767291e877-logbucket-ruckbnlmn8bs
"ee8fedc3-a236-4280-9fab-93f30d9bf706"
[ssm-user@ip-10-96-10-150 ~] $ aws ssm list-command-invocations --details \
> --query "CommandInvocations[*].[InstanceId,DocumentName,Status]" \
> --command-id ee8fedc3-a236-4280-9fab-93f30d9bf706
[
[
"i-098d23c10539215d9",
"AmazonInspector-ManageAWSAgent",
"Success"
],
[
"i-04986f2288531ac84",
"AmazonInspector-ManageAWSAgent",
"Success"
]
]
[ssm-user@ip-10-96-10-150 ~] $ aws inspector create-resource-group --resource-group-tags key=SecurityScan,value=true
{
"resourceGroupArn": "arn:aws:inspector:us-east-1:261289530960:resourcegroup/0-e10qLHIm"
}
[ssm-user@ip-10-96-10-150 ~] $
ssm-user@ip-10-96-10-150 ~] $ aws inspector create-resource-group --resource-group-tags key=SecurityScan,value=true
{
"resourceGroupArn": "arn:aws:inspector:us-east-1:261289530960:resourcegroup/0-e10qLHIm"
}
[ssm-user@ip-10-96-10-150 ~] $ aws inspector create-assessment-target \
> --assessment-target-name GamesDevTargetGroupCLI \
> --resource-group-arn arn:aws:inspector:us-east-1:261289530960:resourcegroup/0-e10qLHIm
{
"assessmentTargetArn": "arn:aws:inspector:us-east-1:261289530960:target/0-RRC8TidP"
}
[ssm-user@ip-10-96-10-150 ~] $ aws inspector list-rules-packages
{
"rulesPackageArns": [
"arn:aws:inspector:us-east-1:316112463485:rulespackage/0-PmNV0Tcd",
"arn:aws:inspector:us-east-1:316112463485:rulespackage/0-R01qwB5Q",
"arn:aws:inspector:us-east-1:316112463485:rulespackage/0-gEjTy7T7",
"arn:aws:inspector:us-east-1:316112463485:rulespackage/0-rExsr2X8"
]
}
黑洞@heidsoft
Github:https://github.com/heidsoft
微博:http://weibo.com/liuganbin
热衷云计算和大数据
关注CloudStack,OpenStack,Linux c/c++/python/java
关注研究新技术