Skip to content

Instantly share code, notes, and snippets.

@miensol miensol/AliceAndBob
Last active Mar 11, 2018

Embed
What would you like to do?
import cloudform, { Lambda, IAM, Fn } from 'cloudform';
import { FunctionProperties } from 'cloudform/types/lambda/function';
import { readFileSync } from 'fs';
const LambdaExecutionRole = 'LambdaExecutionRole', Alice = 'Alice', Bob = 'Bob';
function lambdaFunction(functionCode: string, options?: Partial<FunctionProperties>) {
return new Lambda.Function({
Code: { ZipFile: functionCode },
Handler: "index.main",
Role: Fn.GetAtt(LambdaExecutionRole, "Arn"),
Runtime: "nodejs6.10", ...options
});
}
export default cloudform({
Resources: {
[Alice]: lambdaFunction(readFileSync('Alice.js', 'utf-8'), {
Environment: {
Variables: { BobFunction: Fn.GetAtt(Bob, "Arn") }
}
}),
[Bob]: lambdaFunction(readFileSync('Bob.js', 'utf-8')),
... // LambdaExecutionRole see below
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.