简体   繁体   English

使用 awsebcli 部署 Elastic Beanstalk 应用程序时出现“操作被拒绝”错误

[英]'Operation Denied' Error when deploying an Elastic Beanstalk app using awsebcli

I'm trying to deploy a Django application onto Elastic Beanstalk for the first time.我第一次尝试将 Django 应用程序部署到 Elastic Beanstalk 上。 I've been following two tutorials here and here for assistance but I am running into an issue the tutorials do not seem to cover.我一直在关注这里这里的两个教程以获得帮助,但我遇到了教程似乎没有涵盖的问题。

The steps I followed so far was that I installed awsebcli into a Python3.4 virtual environment and cd to my projects directory.到目前为止,我遵循的步骤是将 awsebcli 安装到 Python3.4 虚拟环境中,并将 cd 安装到我的项目目录中。 I then call eb init .然后我调用eb init I am then prompted to type in my access keys.然后提示我输入我的访问密钥。 I had saved them to a text file so I simply copy and pasted my keys (ensuring no trailing white spaces) into the terminal.我已将它们保存到一个文本文件中,因此我只需将我的密钥(确保没有尾随空格)复制并粘贴到终端中。

The problem is that an error is thrown back:问题是抛出一个错误:

ERROR: Operation Denied.错误:操作被拒绝。 The request signature we calculated does not match the signature you provided.我们计算的请求签名与您提供的签名不匹配。 Check your AWS Secret Access Key and signing method.检查您的 AWS 秘密访问密钥和签名方法。 Consult the service documentation for details.有关详细信息,请参阅服务文档。

The weird thing is that on subsequent attempts an error pops up earlier after I enter the region number for my deployment.奇怪的是,在我为部署输入区域编号后,在随后的尝试中会更早地弹出错误。 But it still prompts me for the keys anyway:但它仍然提示我输入密钥:

ERROR: The current user does not have the correct permissions.错误:当前用户没有正确的权限。 Reason: Operation Denied.原因:操作被拒绝。 The request signature we calculated does not match the signature you provided.我们计算的请求签名与您提供的签名不匹配。 Check your AWS Secret Access Key and signing method.检查您的 AWS 秘密访问密钥和签名方法。 Consult the service documentation for details.有关详细信息,请参阅服务文档。

Here is the full output of eb init --debug :这是eb init --debug的完整输出:

e$ eb init -- debug

Select a default region
1) us-east-1 : US East (N. Virginia)
2) us-west-1 : US West (N. California)
3) us-west-2 : US West (Oregon)
4) eu-west-1 : EU (Ireland)
5) eu-central-1 : EU (Frankfurt)
6) ap-south-1 : Asia Pacific (Mumbai)
7) ap-southeast-1 : Asia Pacific (Singapore)
8) ap-southeast-2 : Asia Pacific (Sydney)
9) ap-northeast-1 : Asia Pacific (Tokyo)
10) ap-northeast-2 : Asia Pacific (Seoul)
11) sa-east-1 : South America (Sao Paulo)
12) cn-north-1 : China (Beijing)
(default is 3): 3
ERROR: The current user does not have the correct permissions. Reason: Operation Denied. The security token included in the request is invalid.
You have not yet set up your credentials or your credentials are incorrect 
You must provide your credentials.
(aws-access-id): xxxxxxxxxxxxxxxxxxxxx
(aws-secret-key): xxxxxxxxxxxxxxxxxxxxxxxxxxx
ERROR: Operation Denied. The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.

The Canonical String for this request should have been
'POST
/

host:elasticbeanstalk.us-west-2.amazonaws.com
x-amz-content-sha256:2dc533b6c6fe3c628385d2b22bfa9e25e75730ee05f85d3b1ce7bacddc535e27
x-amz-date:20160719T134302Z

host;x-amz-content-sha256;x-amz-date
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

The String-to-Sign should have been
'AWS4-HMAC-SHA256
20160719T134302Z
20160719/us-west-2/elasticbeanstalk/aws4_request
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

So it turns out the issue was that my security keys were "out of date".所以事实证明问题是我的安全密钥“过时”。 This is due to my IAM permissions being changed between the generation of the first set of keys and the attempt to deploy my application.这是因为我的 IAM 权限在生成第一组密钥和尝试部署我的应用程序之间发生了变化。

Generating a new set of keys solved the problem.生成一组新的密钥解决了这个问题。

In my case I had to specify the region as well as the profile.就我而言,我必须指定区域和配置文件。 This might be because I'm dealing with both china and the rest of the world.这可能是因为我正在与中国和世界其他地区打交道。

eb init --profile chinaprofile --region cn-northwest-1 eb init --profile chinaprofile --region cn-northwest-1

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

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