Ruby无法从rails控制台执行shell命令

时间:2016-01-27 21:50:54

标签: ruby-on-rails ruby bash shell amazon-web-services

我的一个脚本中有以下命令:

`aws elb describe-instance-health --region eu-west-1 --load-balancer-name FooBar --instances i-05swhkqp'`

执行此操作或从Rails控制台执行时,我收到以下错误并且脚本中断:

A client error (InvalidClientTokenId) occurred when calling the DescribeInstanceHealth operation: The security token included in the request is invalid.
=> ""

但是当我从bash执行它时,我得到了我期望的响应:

{
    "InstanceStates": [
        {
            "InstanceId": "i-05swhkqp",
            "ReasonCode": "N/A",
            "State": "InService",
            "Description": "N/A"
        }
    ]
}

有没有办法将它包含在我的Ruby脚本或Rails控制台上,以便命令可以执行?

0 个答案:

没有答案