3: ECS タスクロール • できるだけ最小権限にする ▪ サービスとアクションの限定 ▪ 対象リソースの限定 { ... snip ... "taskRoleArn": ”TaskRole-ARN-here", "executionRoleArn": "", "containerDefinitions":[{ ... snip ... }], ... snip ... } ECS task definition { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": ["s3:ListBucket"], "Resource": ["arn:aws:s3:::your-bucket"] },{ "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": ["arn:aws:s3:::your-bucket/*"] }] } S3 write-only policy { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": "sqs:SendMessage", "Resource": "arn:aws:sqs:...:your-queue-name" }] } SQS write-only policy { "AttachedPolicies": [{ "PolicyName": "S3WriteOnlyPolicy", "PolicyArn": "S3WriteOnlyPolicy-ARN-here" },{ "PolicyName": "SQSWriteOnlyPolicy", "PolicyArn": "SQSWriteOnlyPolicy-ARN-here" }] } ECS task role 20