Skip to content

Commit

Permalink
Add permissions for batch to execute private ecr image
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Mcgrady committed Aug 7, 2024
1 parent c9eb45d commit 49b4fe5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion overture-tiles-cdk/lib/overture-tiles-cdk-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ export class OvertureTilesCdkStack extends cdk.Stack {
}),
);

const executionRole = new iam.Role(this, `${ID}ExecutionRole`, {
assumedBy: new iam.ServicePrincipal('ecs-tasks.amazonaws.com'),
});

executionRole.addToPolicy(
new iam.PolicyStatement({
actions: [
"logs:CreateLogStream",
"logs:PutLogEvents",
"sts:AssumeRole"
],
resources: ["*"],
}),
);

executionRole.addManagedPolicy(
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonEC2ContainerRegistryReadOnly')
);

for (let theme of [
"addresses",
"admins",
Expand All @@ -102,7 +121,8 @@ export class OvertureTilesCdkStack extends cdk.Stack {
memory: cdk.Size.gibibytes(60),
cpu: 30,
command: [bucket.bucketName, theme],
jobRole: role
jobRole: role,
executionRole: executionRole
},
),
});
Expand Down

0 comments on commit 49b4fe5

Please sign in to comment.