有人可以帮助我了解此错误吗?凭据是通过IAM策略设置的。此框包含在“自动缩放”组中,这是唯一出现以下错误的框。
从实例配置文件元数据服务器检索凭据时出错。如果您不在Amazon EC2内部运行,则在创建客户端时必须在\“ key \”和\“ secret \”选项中提供您的AWS访问密钥ID和秘密访问密钥,或提供实例化的Aws \ Common \ Credentials \ CredentialsInterface对象”
日志: 危急 Phalconry \ Mvc \ Exceptions \ ServerException 额外
"remoteip": "XX.XX.XX.XX, XX.XX.XX.XX",
"userid": "1357416",
"session": "fcke8khsqe4lfo2lj6kdmrd4l7",
"url": "GET:\/manage-competition\/athlete",
"request_identifier": "xxxxxx5c80516bc11532.74367732",
"server": "companydomain.com",
"client_agent": "Mozilla\/5.0 (Linux; Android 9; SM-G965U) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/72.0.3626.121 Mobile Safari\/537.36",
"instance_ip_address": "xx.xx.xx.xx",
"process_id": 29528,
"file": "\/var\/www\/code_deploy\/cfweb\/releases\/20190306195438\/core\/classes\/phalconry\/mvc\/exceptions\/MvcException.php",
"line": 51,
"class": "Phalconry\\Mvc\\Exceptions\\MvcException",
"function": "dispatch"
}```
Context
```{
"Status Code": 500,
"Reason": "Internal Server Error",
"Details": "Array\n(\n [code] => server_error\n [description] => Uncaught Server Error\n [details] => Request could not be processed. Please contact Support.\n)\n",
"Log": "Error retrieving credentials from the instance profile metadata server. When you are not running inside of Amazon EC2, you must provide your AWS access key ID and secret access key in the \"key\" and \"secret\" options when creating a client or provide an instantiated Aws\\Common\\Credentials\\CredentialsInterface object. (Unable to parse response body into JSON: 4)",
"Trace": "#0 [internal function]: Phalconry\\Mvc\\MvcApplication::Phalconry\\Mvc\\{closure}(Object(Phalcon\\Events\\Event), Object(Phalcon\\Mvc\\Dispatcher), Object(Aws\\Common\\Exception\\InstanceProfileCredentialsException))\n#1 [internal function]: Phalcon\\Events\\Manager->fireQueue(Array, Object(Phalcon\\Events\\Event))\n#2 [internal function]: Phalcon\\Events\\Manager->fire('dispatch:before...', Object(Phalcon\\Mvc\\Dispatcher), Object(Aws\\Common\\Exception\\InstanceProfileCredentialsException))\n#3 [internal function]: Phalcon\\Mvc\\Dispatcher->_handleException(Object(Aws\\Common\\Exception\\InstanceProfileCredentialsException))\n#4 [internal function]: Phalcon\\Dispatcher->dispatch()\n#5 \/var\/www\/code_deploy\/cfweb\/releases\/20190306195438\/sites\/games\/lib\/phalcon.php(101): Phalcon\\Mvc\\Application->handle()\n#6 \/var\/www\/code_deploy\/cfweb\/releases\/20190306195438\/sites\/games\/index.php(4): require_once('\/var\/www\/code_d...')\n#7 {main}"
}```
答案 0 :(得分:0)
这些凭据来自实例元数据URL(http://169.254.169.254)。
您可能遇到的问题(尤其是因为您正在ASG中运行),是当您创建AMI然后在另一个可用区中启动它时,到元数据URL的路由不会更新。您需要做的是强制cloud-init在下次启动时运行。
执行此操作的简单方法是清除cloud-init元数据目录:
sudo rm -f /var/lib/cloud/instances/*/sem/config_scripts_user
运行该命令后,请关闭计算机并从中创建AMI。如果您将该AMI用于ASG,则cloud-init将在首次引导时进行完整运行,这将更新到实例元数据URL的路由,并且您的IAM凭据应该起作用。
答案 1 :(得分:0)
实例配置文件凭据的元数据在
下 http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance
如果失败,则可能是服务器启动过的虚拟机管理程序/液滴出现了问题。该端点将为您提供上次刷新凭证的时间。
'http://169.254.169.254/latest/meta-data/identity-credentials/ec2/info'
如果其他具有相同AMI和可用区的服务器没有问题,我将记录支持记录,终止并继续。