Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Dec 15, 2023
1 parent e1ffc5c commit 722cc71
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.

This file was deleted.

19 changes: 19 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,23 @@ const capacityProvider = new ecs.AsgCapacityProvider(this, 'AsgCapacityProvider'
cluster.addAsgCapacityProvider(capacityProvider);
```

The following code retrieve the Amazon Resource Names (ARNs) of tasks that are a part of a specified ECS cluster.
It's useful when you want to grant permissions to a task to access other AWS resources.

```typescript
declare cluster: Cluster;
declare taskDefinition: TaskDefinition;
const taskARNs = cluster.arnForTasks('*'); // arn:aws:ecs:<region>:<regionId>:task/<clusterName>/*

// Grant the task permission to access other AWS resources
taskDefinition.addToTaskRolePolicy(
new iam.PolicyStatement({
actions: ['ecs:UpdateTaskProtection'],
resources: [taskARNs],
})
)
```


### Bottlerocket

Expand Down Expand Up @@ -1576,3 +1593,5 @@ taskDefinition.addContainer('TheContainer', {
}],
});
```

## Retrieve the task ARN which

0 comments on commit 722cc71

Please sign in to comment.