简体   繁体   English

AWS SSM 发送命令来分离 EBS 存储?

[英]AWS SSM send-command to detach EBS storage?

I was trying to detach EBS storage from a Windows EC2 instance using SSM send-command with a target filter named EC2.我试图使用带有名为 EC2 的目标过滤器的 SSM 发送命令从 Windows EC2 实例分离 EBS 存储。 Example:例子:

aws ssm send-command --targets "Key=tag:Name,Values=MYWINDOWSServer" --document-name "AWS-RunShellScript" --parameter "commands = aws ec2 detach-volume --volume-id vol-00000xxxae64a1bd"

The tag name is unique so it should only be executing on 1 server in this account.标签名称是唯一的,因此它应该只在此帐户中的一台服务器上执行。 The output I am getting is confusing and I can't get this working.我得到的 output 令人困惑,我无法让它工作。 Can someone point me in the right direction?有人可以指出我正确的方向吗? Thanks in advance.提前致谢。

Output: Output:

{
    "Command": {
        "CommandId": "934abae5-d28e-49f8-a5a8-a9a9f64c62cc",
        "DocumentName": "AWS-RunShellScript",
        "DocumentVersion": "$DEFAULT",
        "Comment": "",
        "ExpiresAfter": "2021-05-25T13:24:12.765000-04:00",
        "Parameters": {
            "commands": [
                "aws ec2 detach-volume --volume-id vol-00000xxxae64a1bd"
            ]
        },
        "InstanceIds": [],
        "Targets": [
            {
                "Key": "tag:Name",
                "Values": [
                    "MYWINDOWSServer"
                ]
            }
        ],
        "RequestedDateTime": "2021-05-25T10:24:12.765000-04:00",
        "Status": "Pending",
        "StatusDetails": "Pending",
        "OutputS3BucketName": "",
        "OutputS3KeyPrefix": "",
        "MaxConcurrency": "50",
        "MaxErrors": "0",
        "TargetCount": 0,
        "CompletedCount": 0,
        "ErrorCount": 0,
        "DeliveryTimedOutCount": 0,
        "ServiceRole": "",
        "NotificationConfig": {
            "NotificationArn": "",
            "NotificationEvents": [],
            "NotificationType": ""
        },
        "CloudWatchOutputConfig": {
            "CloudWatchLogGroupName": "",
            "CloudWatchOutputEnabled": false
        },
        "TimeoutSeconds": 3600
    }
}

This is the output of the ssm command that you ran.这是您运行的 ssm 命令的 output。 Once you run the SSM command it status is changed to pending and once the command gets completed it's status changes to success/failed/timed out depending on the outcome.运行 SSM 命令后,它的状态将更改为挂起,一旦命令完成,它的状态将根据结果更改为成功/失败/超时。

"Status": "Pending" “状态”:“待定”

Similary, the output you see are all the argumets that return when you run a SSM command.同样,您看到的 output 是运行 SSM 命令时返回的所有参数。 Since this is in command line it is a bit over-whelming.由于这是在命令行中,因此有点不知所措。

I would suggest you to look for this from SSM console in the Run command history.我建议您在运行命令历史记录中从 SSM 控制台中查找此内容。 Look for the command ID: 934abae5-d28e-49f8-a5a8-a9a9f64c62cc查找命令 ID:934abae5-d28e-49f8-a5a8-a9a9f64c62cc

You will get to know if it completed or failed.您将了解它是完成还是失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM