Skip to content

Commit c09747b

Browse files
committed
Add policy for ECS Container to access S3 Bucket
1 parent dd8b7e9 commit c09747b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

backend/src/iac/backend-stack.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,25 @@ export class BackendStack extends cdk.Stack {
604604
// Grant the task role access to the S3 bucket
605605
uploadBucket.grantReadWrite(taskRole);
606606

607+
// Add more specific S3 permissions for file processing
608+
taskRole.addToPolicy(
609+
new iam.PolicyStatement({
610+
effect: iam.Effect.ALLOW,
611+
actions: [
612+
's3:GetObject',
613+
's3:PutObject',
614+
's3:DeleteObject',
615+
's3:ListBucket',
616+
's3:GetObjectTagging',
617+
's3:PutObjectTagging'
618+
],
619+
resources: [
620+
uploadBucket.bucketArn,
621+
`${uploadBucket.bucketArn}/*`
622+
],
623+
})
624+
);
625+
607626
// Outputs
608627
new cdk.CfnOutput(this, 'ReportsTableName', {
609628
value: reportsTable.tableName,

0 commit comments

Comments
 (0)