aws-lambda

Right syntax for multiple input event params in AWS Lambda NodeJS

不问归期 提交于 2020-08-10 19:36:31
问题 Can anyone help me correct with this code in Lambda Nodejs with multiple input event params. I've tried already the following but no luck! ABC = ? WHERE XYZ = ?;', event['ABC', 'XYZ'], function (error, results, fields) ABC = ? WHERE XYZ = ?;', event['ABC']['XYZ'], function (error, results, fields) ABC = ? WHERE XYZ = ?;', event['ABC'], event['XYZ'], function (error, results, fields) 回答1: The correct syntax that you should be using is below. By doing this you're providing them as a list. event

Right syntax for multiple input event params in AWS Lambda NodeJS

女生的网名这么多〃 提交于 2020-08-10 19:35:13
问题 Can anyone help me correct with this code in Lambda Nodejs with multiple input event params. I've tried already the following but no luck! ABC = ? WHERE XYZ = ?;', event['ABC', 'XYZ'], function (error, results, fields) ABC = ? WHERE XYZ = ?;', event['ABC']['XYZ'], function (error, results, fields) ABC = ? WHERE XYZ = ?;', event['ABC'], event['XYZ'], function (error, results, fields) 回答1: The correct syntax that you should be using is below. By doing this you're providing them as a list. event

PATCH method with Lambda integration for update operation on unknown number of parameters

我与影子孤独终老i 提交于 2020-08-10 19:17:24
问题 I have created a resource with PATCH method through API Gateway and have it integrated with Lambda and also have integrated proxy on it. I have hard coded the scenario to update the table. small snippet from the lambda function def lambda_handler(event, context): # reading query parameters to work on from api end point supplierID = event['queryStringParameters']['supplierID'] supplierName = event['queryStringParameters']['supplierName'] supplierID is the primary key of the table and i am

AWS Lambda NodeJS writing to S3 behaves differently on local and sever

独自空忆成欢 提交于 2020-08-09 10:52:28
问题 I created a NodeJS Lambda function with Serverless. It reads from a DynamoDB table and writes the data to a S3 bucket. Here's my handler.js : (showing the affected function): module.exports.exportContactsByClientID = (event, context, callback) => { // const id = event.pathParameters.id.toLowerCase(); const id= 'mkh'; const params = { TableName: contactsTable, IndexName: "client_code-created_at_local-index", KeyConditionExpression: "client_code = :v_ID", ExpressionAttributeValues: { ":v_ID":

NodeJs IF Statement in AWS Lambda using MySQL database

风流意气都作罢 提交于 2020-08-09 08:52:09
问题 I am trying to pass an IF statement (IF data exists in table, [true] update data, [false] insert data) in NodeJS for either of the following queries: var mysql = require('mysql'); var config = require('./config.json'); var pool = mysql.createPool({ host : config.dbhost, user : config.dbuser, password : config.dbpassword, database : config.dbname }); exports.handler = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; pool.getConnection(function(err, connection) {

NodeJs IF Statement in AWS Lambda using MySQL database

无人久伴 提交于 2020-08-09 08:51:05
问题 I am trying to pass an IF statement (IF data exists in table, [true] update data, [false] insert data) in NodeJS for either of the following queries: var mysql = require('mysql'); var config = require('./config.json'); var pool = mysql.createPool({ host : config.dbhost, user : config.dbuser, password : config.dbpassword, database : config.dbname }); exports.handler = (event, context, callback) => { context.callbackWaitsForEmptyEventLoop = false; pool.getConnection(function(err, connection) {

How to insert from csv to dynamodb

守給你的承諾、 提交于 2020-08-08 08:18:34
问题 Dynamo db have one table employees primary key as id data.csv is below which uploaded in the csvdynamo bucket bucket_name = csvdynamo id,name,co 20,AB,PC 21,CD,PC 22,EF,MC 23,GH,MC Need to insert above csv into dynamodb psuedo code for emp in employees: emp_data= emp.split(',') print (emp_data) try: table.put_item( Item = { "emp_id": int(emp_data[0]), "Name": emp_data[1], "Company": emp_data[2] } ) except Exception as e: pass 回答1: Here is an example of a lambda function which works , as I

The checksum value doesn't match for the resource named 'isRecyclableGarden'

走远了吗. 提交于 2020-08-07 09:50:09
问题 So I have recently gotten on board with AWS Lambda and I've been working on a bot since yesterday afternoon but now all of a sudden, this is happening. I whenever I go to build the bot or save the intent, I just keep getting the message 'The checksum value doesn't match for the resource named 'isRecyclableGarden'.' isRecyclableGarden is one of the intents I am using within my code. I can't share the code as it's work code and I am fairly new to this. Any help on how I can work out how to

DynamoDB BatchWriteItem : Provided list of item keys contains duplicates

随声附和 提交于 2020-08-07 05:46:37
问题 I am trying to use DynamoDB operation BatchWriteItem , wherein I want to insert multiple records into one table. This table has one partition key and one sort key. I am using AWS lambda and Go language. I get the elements to be inserted into a slice. I am following this procedure. Create PutRequest structure and add AttributeValues for the first record from the list. I am creating WriteRequest from this PutRequest I am adding this WriteRequest to an array of WriteRequests I am creating

Python boto3 - Athena Query - start_query_execution - The security token included in the request is invalid

偶尔善良 提交于 2020-08-06 06:09:32
问题 My code to get Athena Query is self.athenaDataSource = "AwsCatalog" self.athenaDB = "prod_myapp_app" self.athenaResultBucket = "s3://s3-athena-prod-results/" and here i show I create client and call .start_query_execution clientAthena = boto3.client('athena', region_name=awsRegion) athenaQueryExecResp = clientAthena.start_query_execution( QueryString=self.athenaQuery, QueryExecutionContext={ 'Database': self.athenaDB }, ResultConfiguration={'OutputLocation': self.athenaResultBucket } ) print(