Questions tagged [aws-lambda]

1

votes
0

answer
11

Views

How to create a lambda permission for a custom websocket request authorizer with CloudFormation for API Gateway?

I've been trying to create a lambda permission for a websockets request authorizer for API Gateway and the $connect route. The AWS documenation mentions nothing about creating the proper lambda permission for a websocket authorizer. I keep getting a 500 error when I try to connect to my custom autho...
Thomas Jaeger
1

votes
2

answer
4.4k

Views

API Gateway + Lambda download CSV file

I want to do a csv download link with API Gateway + Lambda. But there is a problem that lambda always return JSON.stringify. Is there a way to resolve this? s-function.json "responses": { "default": { "statusCode": "200", "responseParameters": { "method.response.header.Content-disposition": "'attach...
Jim
1

votes
2

answer
3.1k

Views

how can I get raw body string in Lambda (API gateway Lambda proxy)

After enabled CORS on API gateway, here is the request I sent to the http end point: $.ajax({ type: 'put', url: 'https://xxxxx.execute-api.us-east-1.amazonaws.com/dev/artist/application/julian_test', data: {params: {param1: "543543", param2: "fdasghdfghdf", test: "yes"}}, success: function(msg){ co...
Pano
0

votes
0

answer
5

Views

How to get custom intent slot values using handlerInput in ASK-SDK v2

I'm creating a basic calculator skill using ASK-SDK v2. I'm not sure how to get the slot values provided by the user into the Lambda code with the new version. I was able to make it work with the older version. Conversation User: Open calculate Alexa: You can ask me to add, subtract, multiply and d...
1

votes
1

answer
1.1k

Views

AWS Step Functions: it doesn't show list of existing roles while creating a new state machine

Issue: 1) I create new AWS State Machine with "Hello World" blueprint 2) click on create state machine button 3) it opens a dialog box and choose iam roles dropdown is empty and is not showing list of existing iam roles associated with my aws account Debugging: I found that it throws following JS er...
MColeTrickle
0

votes
0

answer
8

Views

Unable to export contact flow in Amazon Connect due to large size

Hi I have created a contact flow in amazon connect and its complex. There are above 100 blocks (prompts, customer inputs invoke lambda etc) and when i try to export the contact flow (i want to import it in different test environment), it gives the following error "Failed to export contact flow. The...
Muhammad Muneer
1

votes
1

answer
66

Views

cannot create aws lamda function due to some cryptic error message

I am trying to create an aws lambda function but when I click deploy I get this error message: Correct the errors below and try again. Your function's execution role must be assumable by the edgelambda.amazonaws.com service principal. I have absolutely no idea what this means.
dagda1
1

votes
1

answer
56

Views

How to run SQLAlchemy on AWS Lambda in Python

I preapre very simple file for connecting to external MySQL database server, like below: from sqlalchemy import * def run(event, context): sql = create_engine('mysql://root:[email protected]/scraper?charset=utf8'); metadata = MetaData(sql) print(sql.execute('SHOW TABLES').fetchall()) Doesn't work on AW...
kicaj
1

votes
1

answer
45

Views

Multiple Dynamo DB calls from Lambda Node JS

I need to loop through a json and make multiple getitem calls to dynamo db. My issue is that node js flies through the code not waiting for the function return so I can't create an xml that has a header, multiple calculated lines, and then a footer. In the sample below, the !make footer would be wri...
Tommy Do
0

votes
0

answer
4

Views

AWS DynamoDB vs RDS for Lambda serverless architecture

I am part of a team currently developing a Proof of Concept architecture/application for a communication service between governmental offices and the public (narrowed down to the health-sector for now). The customer has specifically requested a mainly serverless approach through AWS services, and I...
Papoy Edits
1

votes
1

answer
9

Views

How to Store Large Python Dependencies on S3 (for AWS Lambda with Serverless)

I am using AWS Lambda to host a Python project, managing deployments using the Serverless framework, and have come up against the commonly-hit 50MB package storage limits. Until now, I've successfully split my requirements up per function using the serverless-python-individually and serverless-pytho...
Zac
1

votes
4

answer
1.7k

Views

AWS Lambda Java how to read properties file

I try to load properties into Properties class from a file. I would expect this solution to work: How to load property file from classpath in AWS lambda java I have a class with few static methods and I want to use it as a Config holder. Inside it there is this line final InputStream inputStream =...
greg
1

votes
1

answer
355

Views

serverless - AWS Lambda scala example

I am trying to deploy with serverless a scala project on AWS lambda. I have followed the tutorial and used this template where I have only replace the default region with eu-central-1a which is where I am based. I get the error ServerlessError: Inaccessible host: cloudformation.eu-central-1a.amazon...
NoIdeaHowToFixThis
1

votes
2

answer
987

Views

Unable to use custom authorizer in API Gateway

I have a couple of days trying to secure my API Gateway using custom authorizers with the auth0 service. I have my lambda which validates my bearer token, the Lambda does work if I invoke it inside the AWS console and when I create a custom authorizer I can successfully tested with a Bearer token. W...
aComanche
1

votes
1

answer
828

Views

Connect to AWS RDS PostgreSQL with AWS Lambda and Golang

I am trying to connect to a AWS RDS PosgreSQL database from a lambda in Go. The authToken seems good in the logs. creds := credentials.NewEnvCredentials() authToken, err := rdsutils.BuildAuthToken("something.eu-west-3.rds.amazonaws.com", "eu-west-3", "Username", creds) if err != nil { fmt.Println("C...
Ludonope
1

votes
1

answer
188

Views

what is the --rest-api-id and --resource-id and where do i find them?

I want to run this command: https://docs.aws.amazon.com/cli/latest/reference/apigateway/test-invoke-method.html It requires these two fields, cant find any docs and were these are: aws apigateway test-invoke-method --rest-api-id 1234123412 --resource-id avl5sg8fw8 --http-method GET --path-with-query...
red888
1

votes
1

answer
45

Views

Access AWS S3 from Lambda within Default VPC

I have a lambda function which needs to access ec2 through ssh and load files and save it to s3. So,for that I have kept ec2 and lambda both in default VPCs and same subnet. Now the problem is that I am able to connect the function to ec2 but not to s3. Its killing me since morning as when I remove...
Tanisha
1

votes
1

answer
42

Views

Error creating a skill with Cloudformation

i have a month developing alexa skills and want to create then via Cloudformation. And for that i am using this: Lambda function { "AWSTemplateFormatVersion": "2010-09-09", "Description": "Lambda Function from Cloud Formation by Felix Vazquez", "Resources": { "Lambda1": { "Type": "AWS::Lambda::Funct...
bhalgalix
1

votes
2

answer
65

Views

Best solution to retry AWS lambda function when it got timeout

I have a serious question and I need your help. I can not find any solution in the Internet after spending a lot of time. I made a bot to get data which is really heavy task because I need to setup a scraper and then it extract data from a webpage through many steps (login, logout, click, submit but...
chau giang
1

votes
3

answer
62

Views

AWS Lambda - processing messages in Batches

I am wondering something, and I really can't find information about it. Maybe it is not the way to go but, I would just like to know. It is about Lambda working in batches. I know I can set up Lambda to consume batch messages. In my Lambda function I iterate each message, and if one fails, Lambda ex...
Vedran Maricevic.
2

votes
1

answer
25

Views

Code times out when trying to run as a lambda function in AWS

Below is my code and I am hoping someone can help me with the cleaning up the code and making it more effiencient. Basically, the code should iterate through all the volumes in my AWS account and then list all untagged volumes and then send out an email. However, it times out when running it as a...
Hits_M
0

votes
0

answer
5

Views

Using serverless framework, how do you define a function handler that resides in a directory that's relative to the parent

I am using serverless framework targeting AWS Lambda. My use case is this: I want to reference a common handler for a custom authorizer I don't want the extra expense of maintaining a separate package or git subrepository I don't want to use symbolic links because that requires extra set up steps fo...
Clinton Chau
1

votes
2

answer
1.1k

Views

AWS: No Messages Available When Sending Message to SQS Queue from Lambda

What are some possible reasons why the following is not working for me? Create a DynamoDB table card_auth_events with at least an id field. Create a trigger that calls a lambda. Here is the lambda: console.log('Loading publishCardAuthEvent...'); var QUEUE_URL = 'https://sqs.us-west2.amazonaws.com/X...
cosbor11
1

votes
3

answer
6.3k

Views

How to send SMS using Amazon SNS from a AWS lambda function

Amazon SNS provides a facility to send SMS globally. I want to send SMS from a Lambda function were we provide the mobile number and text message and use SNS to deliver that message but I didn't find a helpful documentation or example code for NodeJS or java. Can any one suggest a solution? Code: va...
user4045063
1

votes
1

answer
212

Views

is there any service/google cloud api support to invoke file transfer from AWS S3 to google storage, as soon as new file get created in AWS S3 bucket?

Wanted to check with you guys that is there any service/google cloud api support to invoke file transfer from AWS S3 to google storage, as soon as new file get created in AWS S3 bucket? I know that google cloud has storage transfer service, but as per my knowledge it cannot invoked for single file o...
Suyog Kale
1

votes
1

answer
372

Views

AWS Lambda Function Executing Multiple Times (Serverless)

I'm in the process of creating a facebook messenger bot using AWS Lambda and the Serverless framework. For now I just want it to repeat whatever is sent right back to the user. Here is the code: 'use strict'; var https = require('https'); const axios = require('axios'); var VERIFY_TOKEN = "VERIFY";...
Brandon
1

votes
2

answer
164

Views

adding aliased lambda function in cognito pool trigger drop down selection

I have created a lambda function, published a version of it and pointed that version to an alias. ARN for my lambda function: "ARN - arn:aws:lambda:aws_region:aws_id:function:function_name:production". So in cognito pool triggers, I need to assign this lambda function into "Custom message" section,...
Raj
1

votes
2

answer
766

Views

Oauth2 to google people api on aws lambda

I'm trying to use google's people api on aws lambda. As the api requires oauth2 I tried to fetch the oauth2 token locally and then transfer it to aws lambda: I store the secrets with this function: from oauth2client.file import Storage from oauth2client import client, tools def get_credentials(): cr...
hansaplast
1

votes
3

answer
1.4k

Views

S3 resize on upload

I've been trying to run a lambda function when a file is uploaded to my S3 bucket. Every tutorial I follow uses an old version of their UI (basically everything is different) so it's really complicated to accomplish. Right now, I have this: The function I'm using is the only template containing he w...
Catinodeh
1

votes
1

answer
721

Views

How to load data from S3 bucket to Elastic Search in Nodejs Lambda

I want my lambda function (in Nodejs) which will trigger whenever an object is created or updated in amazon S3 bucket and S3 will push the data into elastic search domain. Can anyone please help me out on this and point me to a code or post that handles this in Nodejs?
Ankit Uniyal
1

votes
2

answer
783

Views

How to trigger terraform to upload new lambda code

I deploy lambda using Terraform as follows but have following questions: 1) I want null_resource.lambda to be called always or when stop_ec2.py is changed so that stop_ec2_upload.zip is not out-of-date. What should I write in triggers{}? 2) how to make aws_lambda_function.stop_ec2 update the new sto...
user389955
1

votes
3

answer
1.3k

Views

Lambda.InvokeAccessDenied from Kinesis Firehose

I'm trying to set up Lambda transformations with a Firehose delivery stream. I have an IAM role defined for the Firehose which includes the following policy document: { "Statement": { "Action": [ "lambda:InvokeFunction", "lambda:GetFunctionConfiguration" ], "Resource": [, ...], "Effect": "Allow" } }...
Nathan Brown
1

votes
1

answer
1.5k

Views

How do I access a POST parameter in Node js AWS Lambda with API Gateway integration?

I know how to access GET string variables in a Node js Lambda that is integrated with API Gateway with: event["queryStringParameters"]["variable_name"] What is the equivalent for accessing POST variables?
jaimerr
1

votes
1

answer
221

Views

AWS Lambda not getting invoked when binary data posted in AWS IOT?

I have configured a lambda to a IOT Rule. The MQTT topic will get binary data and on arrival of data the rule should invoke lambda. The lambda gets invoked when I post normal JSON data, but if I post any binary data, the lambda does not get invoked. But at the same time, I am able to consume the bin...
shoki
1

votes
1

answer
330

Views

I want to use Spring Data Rest in aws lambda without Spring Boot & tomcat

How can I use the Spring Data REST feature in AWS Lambda without using the SpringBoot dependencies which has TOMCAT and Other Heavy dependencies with it ? My objective is to create a CRUD Lambda completely based on JSON (HATEOS - id possible) but with minimalistic dependencies - so lambda can fire u...
1

votes
1

answer
505

Views

AWS CodePipeline best practices with 2 AWS accounts

Currently, my project uses 2 AWS accounts - one is for staging that our clients can rely on for testing and the other one is for production/live. I am trying to set up a CodePipeline for a new serverless application. I was wondering if this set up is proper and if there are ways to improve it. Stagi...
nuclear
1

votes
1

answer
1.6k

Views

Unable to import module 'src/index': Error at Function.Module._load (module.js:438:3)

I deployed some changes to a TypeScript project using serverless, I added this code and called it elsewhere: import Mixpanel = require('mixpanel') export default Mixpanel.init(process.env.MIXPANEL_TOKEN) When I now invoke the AWS Lambda function, I receive this error message in my logs: Unable to im...
marktani
1

votes
2

answer
666

Views

Lambda backed custom resource cf template returns 'CREATE_FAILED'

The below lambda function is to associate a SNS topic to the existing directories, followed by a custom resource to invoke the lambda func itself. I see that the lambda creation is successful with the 'Register_event_topic' also completing. However, the stack fails after a while mostly because the '...
CMR H
1

votes
1

answer
551

Views

AWS [email protected] How to read HTML file from S3 and put content in response body

Specifically, in an origin response triggered function (EX. With 404 Status), how can I read an HTML file stored in S3 and use its content for the response body? (I would like to manually return a custom error page just as CloudFront does, but choosing it based on cookies). NOTE: The HTML file in S3...
Ernesto Stifano
1

votes
1

answer
298

Views

CloudFormation Custom Resource not finishing deleting

I have setup my custom resource to return immediately on deletes const aws = require('aws-sdk') const util = require('util') exports.handler = (event, context) => { console.log('Event>>>') console.log(JSON.stringify(event)) aws.config.update({ region: event.ResourceProperties.Region }) if (event.Req...
Jiew Meng

View additional questions