Skip to content

Commit f530334

Browse files
committed
Enable task exec command, describe this in readme
1 parent c26c981 commit f530334

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,34 @@ export type WebServerArgs = {
284284
};
285285
```
286286

287+
#### Exec into running ECS task
288+
289+
**Prerequisites**
290+
291+
1. Install the [Session Manager plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html#install-plugin-macos)
292+
293+
```bash
294+
$ brew install --cask session-manager-plugin
295+
```
296+
297+
2. Install jq
298+
299+
```bash
300+
$ brew install jq
301+
```
302+
303+
In order to exec into running ECS container run the following command:
304+
305+
```bash
306+
aws ecs execute-command \
307+
--cluster CLUSTER_NAME \
308+
--task $(aws ecs list-tasks --cluster CLUSTER_NAME --family TASK_FAMILY_NAME | jq -r '.taskArns[0] | split("/")[2]') \
309+
--command "/bin/sh" \
310+
--interactive
311+
```
312+
313+
Where the `CLUSTER_NAME` is the name of the ECS cluster and `TASK_FAMILY_NAME` is the name of the task family that task belongs to.
314+
287315
## SSM Connect
288316

289317
The [Database](#database) component deploys a database instance inside a private subnet,
@@ -301,6 +329,11 @@ which enables us to connect to the ec2 instance even though it's inside private
301329
**Prerequisites**
302330

303331
1. Install the [Session Manager plugin](https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html#install-plugin-macos)
332+
333+
```bash
334+
$ brew install --cask session-manager-plugin
335+
```
336+
304337
2. Generate a new ssh key pair or use the existing one.
305338

306339
```bash

src/components/web-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export class WebServer extends pulumi.ComponentResource {
345345
([containerName, image, port, environment, logGroup, region]) => {
346346
return JSON.stringify([
347347
{
348-
readonlyRootFilesystem: true,
348+
readonlyRootFilesystem: false,
349349
name: containerName,
350350
image,
351351
essential: true,

0 commit comments

Comments
 (0)