Skip to content

Commit 631041b

Browse files
committed
Update README.md
1 parent 70aae0e commit 631041b

File tree

1 file changed

+40
-23
lines changed

1 file changed

+40
-23
lines changed

README.md

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -617,40 +617,50 @@ docker compose up --abort-on-container-exit --build
617617

618618
**Goal:** Connect to LocalStack.
619619

620-
### Add LocalStack Service to `docker-compose.yaml`
620+
### Add LocalStack service to `docker-compose.yaml`
621621

622622
```yaml
623-
localstack:
624-
image: localstack/localstack
625-
healthcheck:
626-
test:
627-
- CMD
628-
- curl
629-
- -f
630-
- http://localhost:4566/_localstack/health
631-
interval: 1s
632-
timeout: 1s
633-
retries: 30
623+
services:
624+
# ... existing config
625+
localstack:
626+
image: localstack/localstack
627+
healthcheck:
628+
test:
629+
- CMD
630+
- curl
631+
- -I
632+
- http://localhost:4566/_localstack/health
633+
interval: 1s
634+
timeout: 1s
635+
retries: 30
634636
```
635637
636638
### Update Lambda config
637639
638640
Update `docker-compose.yaml`:
639641

640642
```yaml
641-
depends_on:
642-
localstack:
643-
condition: service_healthy
644-
environment:
645-
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: 128
646-
AWS_LAMBDA_FUNCTION_TIMEOUT: 3
647-
AWS_LAMBDA_LOG_FORMAT: JSON
648-
AWS_ENDPOINT_URL: http://localstack:4566
649-
AWS_SECRET_ACCESS_KEY: test
650-
AWS_ACCESS_KEY_ID: test
651-
AWS_REGION: us-east-1
643+
services:
644+
# ... existing config
645+
lambda:
646+
# ... existing config
647+
depends_on:
648+
localstack:
649+
condition: service_healthy
650+
environment:
651+
AWS_LAMBDA_FUNCTION_MEMORY_SIZE: 128
652+
AWS_LAMBDA_FUNCTION_TIMEOUT: 3
653+
AWS_LAMBDA_LOG_FORMAT: JSON
654+
AWS_ENDPOINT_URL: http://localstack:4566
655+
AWS_SECRET_ACCESS_KEY: test
656+
AWS_ACCESS_KEY_ID: test
657+
AWS_REGION: us-east-1
658+
# ... existing config
652659
```
653660

661+
> [!WARNING]
662+
> Even though we aren't connecting to a real AWS account, the environment variables are still needed.
663+
654664
### Update code
655665

656666
Run this command to start an interactive shell:
@@ -659,6 +669,9 @@ Run this command to start an interactive shell:
659669
docker compose run -it --rm --no-deps --entrypoint /bin/sh -v ./nodejs:/var/task lambda
660670
```
661671

672+
> [!TIP]
673+
> The `--no-deps` makes sure we are only running the `lambda` container and ignoring any others.
674+
662675
Install the SDK:
663676

664677
```shell
@@ -715,6 +728,10 @@ Run the following command:
715728
docker compose up --abort-on-container-exit --build
716729
```
717730

731+
> [!NOTE]
732+
> During this build you'll notice both the `npm ci` and `npm run build` layers are rebuilt.
733+
> Also, as we haven't actually created any buckets, receiving an empty array is the correct response.
734+
718735
---
719736

720737
## 7. Bonus: Swapping runtimes

0 commit comments

Comments
 (0)