daily pastebin goal
85%
SHARE
TWEET

Untitled

a guest Nov 17th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import boto3
  2. import os
  3. import uuid
  4.  
  5. def lambda_handler(event, context):
  6.    
  7.     cityName = event["cityName"]
  8.     cityDescription = event["cityDescription"]
  9.  
  10.     print('Input cityName: ' + cityName)
  11.     print('Input Description: ' + cityDescription)
  12.    
  13.     #Creating new record in DynamoDB table
  14.     dynamodb = boto3.resource('dynamodb')
  15.     table = dynamodb.Table(os.environ['DB_TABLE_NAME'])
  16.     table.put_item(
  17.         Item={
  18.             'city' : cityName,
  19.             'description' : cityDescription
  20.         }
  21.     )
RAW Paste Data
Top