Skip to content

Commit 5e0c9bb

Browse files
committed
Pass AWS credentials into the bundling context
1 parent 9ce3b92 commit 5e0c9bb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/cdk/resources/LambdaFunction.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,17 @@ export class LambdaFunction extends Construct {
139139

140140
commands.push(`cp -a . ${outputDir}`)
141141

142-
execSync(commands.join(" && "), {cwd, stdio: "inherit"})
142+
execSync(commands.join(" && "), {
143+
cwd,
144+
stdio: "inherit",
145+
env: {
146+
...process.env, // Propagate parent environment
147+
AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID || "",
148+
AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY || "",
149+
AWS_SESSION_TOKEN: process.env.AWS_SESSION_TOKEN || "",
150+
AWS_REGION: process.env.AWS_REGION || "eu-west-2"
151+
}
152+
})
143153

144154
return true
145155
}

0 commit comments

Comments
 (0)