Skip to content

Commit fdbbf35

Browse files
authored
Update CDK hot reloading docs (#217)
1 parent 580f842 commit fdbbf35

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

content/en/integrations/aws-cdk/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ $ awslocal sns list-topics
8383
}
8484
{{< /command >}}
8585

86+
## Other resources
87+
- [Hot-swapping Lambda functions with CDK]({{< ref "tools/lambda-tools/hot-swapping#aws-cloud-development-kit-cdk-configuration" >}})
88+
8689
## External resources
8790

8891
- [aws-cdk-local](https://github.com/localstack/aws-cdk-local)

content/en/tools/lambda-tools/hot-swapping/index.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ class ApplicationStack(parent: Construct, name: String) : Stack(parent, name) {
292292
*/
293293
private fun buildCodeSource(): Code {
294294
if (STAGE == "local") {
295-
val bucket = Bucket.fromBucketName(this, "HotReloadingBucket", "__local__")
295+
/**
296+
* For CDK you have to use a valid S3 bucket name instead of '__local__'
297+
* because of client-side validation
298+
*/
299+
val bucket = Bucket.fromBucketName(this, "HotReloadingBucket", "hot-code")
296300
return Code.fromBucket(bucket, LAMBDA_MOUNT_CWD)
297301
}
298302

@@ -301,6 +305,13 @@ class ApplicationStack(parent: Construct, name: String) : Stack(parent, name) {
301305
}
302306
{{< / highlight >}}
303307

308+
{{% alert %}}
309+
310+
**Note**: As mentioned in the code, you will have to use an alternative local bucket marker to `__local__` as this is not a valid S3 bucket name.
311+
To change it (to, e.g., `hot-code`) you can use the environment variable `BUCKET_MARKER_LOCAL`.
312+
313+
{{% /alert %}}
314+
304315
Then to bootstrap and deploy the stack run the following shell script
305316

306317
{{< command >}}

0 commit comments

Comments
 (0)