Skip to content

Instantly share code, notes, and snippets.

@miensol
Created March 11, 2018 21:14
Show Gist options
  • Save miensol/d88ff385bf31beb71d1998e2bb74424e to your computer and use it in GitHub Desktop.
Save miensol/d88ff385bf31beb71d1998e2bb74424e to your computer and use it in GitHub Desktop.
import cloudform, { Lambda, IAM, Fn } from 'cloudform';
const LambdaExecutionRole = 'LambdaExecutionRole';
cloudform({
Resources: {
HelloWorld: new Lambda.Function({
Code: {
ZipFile: "exports.wrtiteToConsole = function (event, context, callback){ console.log('Hello'); callback(null); }"
},
Handler: "index.wrtiteToConsole",
Role: Fn.GetAtt(LambdaExecutionRole, "Arn"),
Runtime: "nodejs6.10"
}),
[LambdaExecutionRole]: new IAM.Role({
AssumeRolePolicyDocument: {
Statement: [{
Effect: "Allow",
Principal: { Service: ["lambda.amazonaws.com"] },
Action: ["sts:AssumeRole"]
}]
},
Path: "/",
ManagedPolicyArns: ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"]
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment