Create Your Own Serverless Application http://docs.aws.amazon.com/lambda/latest/dg/serverless-deploy-wt.html
aws cloudformation deploy \
--template-file serverless-output.yaml \
--stack-name new-stack-name \
--capabilities CAPABILITY_IAM
aws cloudformation package \
--template-file example.yaml \
--output-template-file serverless-output.yaml \
--s3-bucket s3-bucket-name
aws s3 mb s3://bucket-name --region region
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
TestFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs6.10
Environment:
Variables:
S3_BUCKET: bucket-name
var AWS = require('aws-sdk');
exports.handler = function(event, context, callback) {
var bucketName = process.env.S3_BUCKET;
callback(null, bucketName);
}