概要
OpsWorksで構築したアプリにAWSコンソールのOpsWorksからデプロイを行ったら、いつまでたっても完了しないということが起こり調査した。
opsworks-agentのバージョンは3437
調査
/var/log/aws/opsworks/opsworks-agent.process_command.log
[2017-11-02 20:00:00] ERROR [opsworks-agent(23123)]: process_command: Failed to report status of process_command: 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
* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV
* 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.
opsworks-agent.process_command.logを見たところ,
AWS::Errors::MissingCredentialsErrorになってるが、該当のEC2インスタンスにはIAM Roleを付与して適切なIAMポリシーを設定してあるのでAWS_ACCESS_KEY_IDとAWS_SECRET_ACCESS_KEYは環境変数に設定しなくても動くはずである。
解決方法
結局opsworks-agentの再起動で直った。
/ect/init.d/opsworks-agent restart