aws-lambda

AWS Lambda @ng-toolkit failing for TypeError: express is not a function in angular 9 app

柔情痞子 提交于 2021-02-20 04:58:56
问题 I started deploying my demo Angular 9 application on AWS lambda and provide SSR. In order to achieve this, I used @ng-toolkit/universal and @ng-toolkit/serverless. Deployment happened successfully but demo application is not opening. Upon investigating AWS lambda logs, I found the following exception. Here is the package.json, where I have added express js in dependencies. { "name": "my-appg", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng

AWS lambda function with runtime python 3.7 does not utilizing connection pool in rds proxy instead it create new connection on every request

本秂侑毒 提交于 2021-02-20 03:42:28
问题 I am using AWS lambda functions for a few months now. so far I have cached the connection in the lambda function memory to reuse. After reading about AWS rds proxy recently, I am trying to utilize the connection pool for the lambda functions(Runtime python3.7). so to test the way rds proxy works with lambda functions, I created two functions with runtime node12 and python3.7, the behaviours was this. 1. node12 function => When I run this function, it pools two connection in the proxy and

AWS Cloudwatch Event Rule - Invoke Lambda - with Parameter

那年仲夏 提交于 2021-02-19 08:34:19
问题 I am using AWS Clouwatch Event Rule to invoke a python lambda function based on Cron Schedule which is working fine.Now can I pass parameter into this lambda function from cloudwatch even rule using AWS Cloudformation? Could you please guide? Please see below my cfn template : Step1 : parameter.Schedule=cron(0 21 ? * * *) Step 2: "Schedule": { "Description": "Schedule for the Lambda function (cron or rate)", "Type": "String" }, Step 3: "funcInvokeRule": { "Type": "AWS::Events::Rule",

How to make a HTTP rest call in AWS lambda using python?

孤街浪徒 提交于 2021-02-19 08:08:05
问题 To make an http call using python my way was to use requests . But requests is not installed in lambda context. Using import requests resulted in module is not found error. The other way is to use the provided lib from botocore.vendored import requests . But this lib is deprecated by AWS. I want to avoid to package dependencies within my lambda zip file. What is the smartest solution to make a REST call in python based lambda? 回答1: Solution 1) Since from botocore.vendored import requests is

PowerShell Core Script deployed as AWS Lambda function fails to remote connect into Windows EC2 Instance using the Commandlet new-pssession

爱⌒轻易说出口 提交于 2021-02-19 07:34:07
问题 AWS Recently announced Lambda Support for PowerShell Core. Reference URL https://aws.amazon.com/blogs/developer/announcing-lambda-support-for-powershell-core/ Followed the steps given in the URL and deployed below Powershell Core script as a Lambda Function. Script: #Requires -Modules @{ModuleName='AWSPowerShell.NetCore';ModuleVersion='3.3.335.0'} $pw = convertto-securestring -AsPlainText -Force -String "Password" $cred = new-object -typename System.Management.Automation.PSCredential

Triggering a lambda from SNS using cloud-formation?

可紊 提交于 2021-02-19 06:16:05
问题 Triggering a lambda from SNS using cloud-formation? 回答1: What we do is that we don't point sns to an unqualified lambda, rather we point it to a lambda-alias. Basically, create a lambda, and then create an alias, use sns to point to the lambda-alias. When you have new code for lambda (your ci/cd can do the following), update lambda function code, create a new lambda version, and repoint your alias to the new version. This way you sns doesn't have to change at all with new lambda code drops.

How to access the raw query string (or full URL) in a Chalice (AWS Lambda/API Gateway) app?

烈酒焚心 提交于 2021-02-19 06:01:34
问题 I'm using Chalice to build a fairly straightforward API on AWS Lambda & API Gateway. I need a way to get access to the raw query string (i.e foo=bar&abc=123 ). When accessing the app.current_request.query_params dictionary, it's already been processed, such that any empty parameters ( foo=&bar= ) have been stripped out. Unfortunately I'm working with a third-party API that sends a signed hash value in the query string, based off the raw query string. I can't verify it without the original,

AWS lambda send partial response

亡梦爱人 提交于 2021-02-19 05:55:10
问题 I have a lambda function which does a series of actions. I have a react application which triggers the lambda function. Is there a way I can send a partial response from the lambda function after each action is complete. const testFunction = (event, context, callback) => { let partialResponse1 = await action1(event); // send partial response to client let partialResponse2 = await action2(partialResponse1); // send partial response to client let partialResponse3 = await action3

Why is my containerized Selenium application failing only in AWS Lambda?

懵懂的女人 提交于 2021-02-19 05:53:47
问题 I'm trying to get a function to run in AWS Lambda that uses Selenium and Firefox/ geckodriver in order to run. I've decided to go the route of creating a container image, and then uploading and running that instead of using a pre-configured runtime. I was able to create a Dockerfile that correctly installs Firefox and Python, downloads geckodriver , and installs my test code: FROM alpine:latest RUN apk add firefox python3 py3-pip RUN pip install requests selenium RUN mkdir /app WORKDIR /app

AWS lambda read parameter or outputs from CloudFormation

故事扮演 提交于 2021-02-19 04:53:45
问题 Looks as really simple task but it's difficult to find good example on it. So, the task is following: AWS lambda puts some message to AWS-SQS. Code of AWS lambda contains such line: var QUEUE_URL = 'https://sqs.us-west-2.amazonaws.com/ID/QUEUE_NAME';", In order to get rid of this code there are possible two options: Create query that will lookup this queue based on region and queue name SQS has predictable names; Create Cloud Formaion script and specify these dependencies there. Based on this