Chaos Monkey:AWS EC2:HTTP / 1.1 401连接到eu-central-1(法兰克福)时未经授权的错误

时间:2015-01-21 07:35:39

标签: amazon-web-services netflix aws-sdk simian

我们正在使用Chaos monkey在AWS ec2客户端上进行弹性测试。当chaos monkey尝试使用法兰克福地区的给定密钥进行身份验证时,我们收到了HTTP / 1.1 401 Unauthorized error.We正在使用AWS SDK for Java。

使用签名版本v2和eu-central-1(法兰克福)需要v4。 我们如何将签名版本设置为v4或我们必须对AWS SDK进行哪些设置?

以下是错误的快照: -

2015-01-19 05:37:05.028 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] Sending request -1804412292: POST https://ec2.eu-central-1.amazonaws.com/ HTTP/1.1

2015-01-19 05:37:05.029 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] >> "Action=DescribeInstances&Signature=Ao5fLfM%2B/rOcbdll0LF0K2F9U8NBlgd%2BAwuFk83GOxo%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-19T10%3A37%3A05.024Z&Version=2010-06-15&AWSAccessKeyId=xxx"

2015-01-19 05:37:05.029 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] >> POST https://ec2.eu-central-1.amazonaws.com/ HTTP/1.1

2015-01-19 05:37:05.029 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] >> Host: ec2.eu-central-1.amazonaws.com

2015-01-19 05:37:05.030 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] >> Content-Type: application/x-www-form-urlencoded

2015-01-19 05:37:05.030 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] >> Content-Length: 225

2015-01-19 05:37:05.609 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] Receiving response -1804412292: HTTP/1.1 401 Unauthorized
2015-01-19 05:37:05.610 - DEBUG SLF4JLogger - [SLF4JLogger.java:61] << HTTP/1.1 401 Unauthorized

1 个答案:

答案 0 :(得分:0)

设置v4签名is explained here。 Java的相关部分:

在代码中添加以下内容。

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");

或者,在命令行中指定以下内容。

-Dcom.amazonaws.services.s3.enableV4