我的目標是使用AWS Beanstalk,創建應用程序環境類型'Worker',該類型將處理重負載任務,這名工作人員基於我們的Rails應用程序。 我創建了AWS Beanstalk工作環境: 環境層:Ruby,1.9.3在64位亞馬遜Linux 環境類型:單實例 (我嘗試了使用運行Ruby 2.0(Puma)的64位Amazon Linux 2014.03 v1.0.3,結果相同)AWS Beanstalk Worker無法啓動SQS守護進程aws-sqsd
在解決了GEMS和數據庫連接的所有問題後,我停留在啓動「aws-sqs」隊列客戶端。它應該偵聽隊列並對Worker應用程序執行HTTP請求。 我提供AWS_ACCESS_KEY_ID和AWS_SECRET_KEY爲這個工人實例ENV變量:
$ export | grep AWS
declare -x AWS_ACCESS_KEY_ID="AK...........Q"
declare -x AWS_AUTO_SCALING_HOME="/opt/aws/apitools/as"
declare -x AWS_CLOUDWATCH_HOME="/opt/aws/apitools/mon"
declare -x AWS_ELB_HOME="/opt/aws/apitools/elb"
declare -x AWS_IAM_HOME="/opt/aws/apitools/iam"
declare -x AWS_PATH="/opt/aws"
declare -x AWS_RDS_HOME="/opt/aws/apitools/rds"
declare -x AWS_SECRET_KEY="Hp.....fI"
declare -x EB_CONFIG_SYSTEM_AWSEBAGENTID=""
declare -x EB_CONFIG_SYSTEM_AWSEBREFERRERID=""
這裏是日誌輸出:
2014-05-19T13:58:59Z init: initializing aws-sqsd 1.0 (2013-12-23)
2014-05-19T13:58:59Z start: polling https://sqs.us-east-1.amazonaws.com/201266939336/awseb-e-dq8cqaud2z-stack-AWSEBWorkerQueue-18836XBBHNDUD
2014-05-19T13:58:59Z fatal: AWS::Errors::MissingCredentialsError:
Missing Credentials.
Unable to find AWS credentials. You can configure your AWS credentials
a few different ways:
* Call AWS.config with :access_key_id and :secret_access_key
<<<
* On EC2 you can run instances with an IAM instance profile and credentials
will be auto loaded from the instance metadata service on those
instances.
* Call AWS.config with :credential_provider. A credential provider should
either include AWS::Core::CredentialProviders::Provider or respond to
the same public methods.
= Ruby on Rails
In a Ruby on Rails application you may also specify your credentials in
the following ways:
* Via a config initializer script using any of the methods mentioned above
(e.g. RAILS_ROOT/config/initializers/aws-sdk.rb).
* Via a yaml configuration file located at RAILS_ROOT/config/aws.yml.
This file should be formated like the default RAILS_ROOT/config/database.yml
file.
我也有配置/初始化/ AWS-sdk.rb在我的Rails應用於此內容:
AWS.config(
access_key_id: ENV["AWS_ACCESS_KEY_ID"],
secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"])
守護程序aws-sqs根本不開始。 我可以有機會以其他方式配置aws-sqs嗎?