【发布时间】:2021-07-07 03:19:31
【问题描述】:
我目前正在将 ECS 任务(EC2 托管)用于使用 firelens Fluent Bit 作为日志路由器的 Web 应用程序。我使用this plug-in 将输出目标设置为S3,但它收到如下访问错误:[error] [output:s3:s3.3] PutObject API responded with error='AccessDenied', message='Access Denied。
我的 Fluent Bit 的配置文件是这样的:
[OUTPUT]
Name s3
Match app
region ap-northeast-1
bucket BUCKET_NAME
s3_key_format /logs/app/%Y/%m/%d/%H/logs_ecs_$uuid_flush.txt
store_dir /tmp/fluent-bit/s3
upload_chunk_size 10m
upload_timeout 10s
我尝试的是:
- 将 AmazonS3FullAccess 策略附加到任务角色。
- 添加允许从任务角色访问的存储桶策略,如下所示:
{ "Effect": "Allow", "Principal": { "AWS": "TASK_ROLE_ARN" }, "Action": "s3:*", "Resource": [ "arn:aws:s3:::BUCKET_NAME", "arn:aws:s3:::BUCKET_NAME/*" ] }
这些都不能解决问题。有没有我遗漏的配置?
感谢您的帮助。
【问题讨论】:
-
你可以回答你的问题,而不是用解决方案更新问题
-
感谢您的评论!我会移动解决方案来回答。
标签: amazon-s3 amazon-ecs fluent-bit