In this section, we will create a simple serverless application, which consists of a single function. It will return Amazon S3 bucket name that is specified as an environment variable.
Create the index.js file with the following code:
var AWS = require('aws-sdk'); exports.handler = function(event, context, callback) { var bucketName = process.env.S3_BUCKET; callback(null, bucketName); }
Create the packt.yaml file with the following code:
AWSTemplateFormatVersion: '2010-09-09'Transform: AWS::Serverless-2016-10-31Resources: PacktFunction: Type: AWS::Serverless::Function Properties: Handler: index.handler Runtime: nodejs6.10 Environment: Variables: S3_BUCKET: packtdemo
Create the packt_app folder ...