使用 Docker 容器的 AWS Cloudwatch 日志 - NoCredentialProviders:链中没有有效的提供者
AWS Cloudwatch logs with Docker Container - NoCredentialProviders: no valid providers in chain
我的docker-撰写文件:
version: '2'
services:
scraper:
build: ./Scraper/
logging:
driver: "awslogs"
options:
awslogs-region: "eu-west-1"
awslogs-group: "doctors-logs"
awslogs-stream: "scrapers-stream"
volumes:
- ./Scraper/spiders:/spiders
我已使用 aws configure 命令将我的 AWS 凭据添加到我的 mac,并且凭据正确存储在 ~/.aws/credentials
当我 运行 docker-compose 时,我收到以下错误:
ERROR: for scraper Cannot start service scraper: Failed to initialize logging driver: NoCredentialProviders: no valid providers in chain.
Deprecated.
For verbose messaging see aws.Config.CredentialsChainVerboseErrors
ERROR: Encountered errors while bringing up the project.
我认为这是因为我需要在 Docker 守护程序中设置 AWS 凭据,但我不知道如何在 macOs Sierra 上完成此操作。
我想通了。在滚动您自己的 EC2 实例时(不使用像 Beanstalk 这样的自动化解决方案),您需要为您的 EC2 实例分配一个角色,以便它能够与其他 AWS 服务通信。
该政策是 Docker 文档在 https://docs.docker.com/engine/admin/logging/awslogs/
中提供的政策
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
然后您需要将此策略附加到角色
角色是第一个叫"Amazon EC2"的角色,读作"Allows EC2 instances to call AWS services on your behalf."
由于您只限制了对 CloudWatch 的访问,所以您可以开始了。然后,在您的 EC2 列表中,使用 "Attach/Replace IAM Role":
将该角色附加到您的实例
你应该可以开始了!
Attach/Replace IAM Role
已作为 Modify IAM role
移至 security
菜单
多亏了 ridox
我的docker-撰写文件:
version: '2'
services:
scraper:
build: ./Scraper/
logging:
driver: "awslogs"
options:
awslogs-region: "eu-west-1"
awslogs-group: "doctors-logs"
awslogs-stream: "scrapers-stream"
volumes:
- ./Scraper/spiders:/spiders
我已使用 aws configure 命令将我的 AWS 凭据添加到我的 mac,并且凭据正确存储在 ~/.aws/credentials
当我 运行 docker-compose 时,我收到以下错误:
ERROR: for scraper Cannot start service scraper: Failed to initialize logging driver: NoCredentialProviders: no valid providers in chain.
Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors
ERROR: Encountered errors while bringing up the project.
我认为这是因为我需要在 Docker 守护程序中设置 AWS 凭据,但我不知道如何在 macOs Sierra 上完成此操作。
我想通了。在滚动您自己的 EC2 实例时(不使用像 Beanstalk 这样的自动化解决方案),您需要为您的 EC2 实例分配一个角色,以便它能够与其他 AWS 服务通信。
该政策是 Docker 文档在 https://docs.docker.com/engine/admin/logging/awslogs/
中提供的政策{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
然后您需要将此策略附加到角色
角色是第一个叫"Amazon EC2"的角色,读作"Allows EC2 instances to call AWS services on your behalf."
由于您只限制了对 CloudWatch 的访问,所以您可以开始了。然后,在您的 EC2 列表中,使用 "Attach/Replace IAM Role":
将该角色附加到您的实例你应该可以开始了!
Attach/Replace IAM Role
已作为 Modify IAM role
security
菜单
多亏了 ridox