Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 38 additions & 13 deletions text/0001-cdk-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,45 @@ Checking stack DataStack for possible hotswap update
Watching stack inputs for changes:
* LambdaFunction[Appfunction]: <spinner>
* LambdaFunction[StreamFunction]: <spinner>

```

The watcher can only watch for file changes. For Lambda code, that means that
directories will be watched for changes and zipped if they change. If the file
asset is a zip file, then the update will fire whenever that changes. The
existing docker asset builder will be used to watch for changes in local docker
images.
The "watch" functionality can be customized by setting a few new options in your `cdk.json` file:

1. If either your CDK code, or your runtime code
(like the code of your Lambda functions)
needs to go through a build step before invoking `cdk deploy`,
you can specify that command in the new `"build"` key. Example:

```json
{
"app": "mvn exec:java",
"build": "mvn package"
}
```

If the `"build"` key is present in the `cdk.json` file,
`cdk synth` (which the "watch" process invokes before deployment)
will execute the specified command before performing synthesis.

2. The "watch" process needs to know which files and directories to observe for changes,
and which ones to ignore. You can customize these using the `"include"` and `"exclude"`
sub-keys of the new `"watch"` top-level key.
Values are glob patterns that are matched _relative to the location of the `cdk.json`_ directory:

```json
{
"app": "mvn exec:java",
"build": "mvn package",
"watch": {
"include": ["src", "lambda/code/**/*"],
"exclude": ["cdk.out", "target"]
}
}
```

The `cdk init` command fills these out for you,
so if your project has a standard layout,
you shouldn't need to modify these from the generated defaults.

In addition to the monitoring mode, it is possible to perform one-shot
hotswap deployments on some or all of the stacks in the CDK application:
Expand Down Expand Up @@ -123,18 +154,12 @@ Deploying DataStack
Done!
```

In addition to running in a one shot mode, the `cdk deploy --hotswap`
command also has a `--watch` command line option that enable it to monitor the
assets on disk and perform an update when they change.

#### Resource Support

- AWS Lambda `Function`
- file and directory assets
- StepFunction
- Workflow definitions
- AWS Fargate
- image assets
- State Machine definitions
- ECS
- image assets

Expand Down