aws-lambda

How to add add if condition in AWS SES html template?

若如初见. 提交于 2021-01-27 23:33:04
问题 Requirement is to send templated mail based on received bodydata from api. BodyData may not contain some tags. see below sample Template part. <p>{{sender}} has invited you to join team {{teamName}}</p> so body data may not contain teamName. So I want to put if condition on {{teamName}} in template. Please help me here to find solution 回答1: For conditional logic in an SES template you can use if else statements like you would in code. For your example you would use something like <p>{{sender}

API Gateway - Body Mapping Template - optional body parameters

孤人 提交于 2021-01-27 20:10:02
问题 I have a POST API Gateway method to which I am sending the following application/json body in order to pass parameters from it to a Lambda that the method is connected to: { "otherClientId": "12345", "message": "Text", "seconds": 0, "hours": 0 } I am using the following mapping template: #set($inputRoot = $input.path('$')) { "authorizedUser": "$context.authorizer.principalId", "otherClientId": "$inputRoot.otherClientId", "message": "$inputRoot.message", "amount": $inputRoot.amount, "duration"

Using pydub and AWS Lambda

无人久伴 提交于 2021-01-27 20:08:30
问题 Afternoon All - So I think the title does say most of it but here goes. I'm new to the land of AWS and Lambda and having all sorts of fun learning this. I'm working on a project were I want to automagically merge two files stores in S3. I found this lambda function from the find folks at AWS (https://github.com/aws-samples/chime-voiceconnector-agent-assist/blob/master/infrastructure/function/src/retrieveMergedAudioUrl/lambda_function.py) and it references: from pydub import AudioSegment So

AWS - Is there a way to 'hook' into when a federated identity is created for the first time?

一曲冷凌霜 提交于 2021-01-27 20:01:56
问题 I have a Cognito Identity Pool that is used to authenticate my front end users, as well as give them certain permissions in my application. However, I have encountered an issue with giving these users permission to access IoT, which involves invoking a Lambda calling iot.addPrincipalPolicy() , and once that is done then everything works flawlessly. However, the issue I am facing is that right now I am running this function is being called every time my user requests authentication, when it

AWS Lambda Error: Unable to import module 'function_name': No module named 'module._module'

蓝咒 提交于 2021-01-27 19:24:07
问题 Please see the screenshots in particular after reading. I am deploying a python script on AWS Lambda which uses the package impyla which has a dependency on the package bitarray . from impala.dbapi import connect My python file is called authorize_ingress.py which has a function called handle_authorize_ingress(event, context) which are properly configured. See the screenshots below: My function's file: The handler in lambda specified: The handler in code itself: and my zip file has everything

Why only 50 instances working on AWS lambda?

柔情痞子 提交于 2021-01-27 18:54:21
问题 I am using context.logStreamName to identify the lambda instance. Concurrency is set to unreserved. But it the log shows out only 50 instance is working. Am I misunderstand the logStream (pre logStream pre instance)? I'd got the information from this blog Below is my corresponding code: let instances = {}; for (let i = 0; i < each_invokes; i++) { lambda.invoke(params, function (err, data) { if (err) { console.log(err, err.stack); } else { // console.log(data); let logs = Buffer.from(data

Running Selenium on AWS Lambda

风流意气都作罢 提交于 2021-01-27 17:12:14
问题 I know this is a frequently asked question, I have checked many answers and tried everything but still can't find a solution. I am trying to run Selenium with Python 3.6 on AWS Lambda and created the deployment package using Docker. I followed the following steps for Docker: sudo docker run -v $(pwd):/outputs --name linked_in -d amazonlinux:latest tail -f /dev/null sudo docker exec -i -t linked_in /bin/bash /outputs/buildPack_py.sh This is what my buildPack_py.sh file looks like: python

Aws lambda proxy Swagger template integration

元气小坏坏 提交于 2021-01-27 14:32:24
问题 I'm trying to setup swagger template to call my all in one lambda. lets say there are two "functions" underneath processlambda. Would this be a correct openapi 3.0 template, or do I have to specifically configure request types and response types { "openapi": "3.0.0", "info": { "version": "2016-09-12T17:50:37Z", "title": "ProxyIntegrationWithLambda" }, "paths": { "/GetItemById": { "x-amazon-apigateway-any-method": { "parameters": [ { "name": "proxy", "in": "path", "required": true, "schema": {

How to make the copy command continue its run in redshift even after the lambda function which initiated it has timed out?

自闭症网瘾萝莉.ら 提交于 2021-01-27 13:25:06
问题 I am trying to run a copy command which loads around 100 GB of data from S3 to redshift. I am using the lambda function to initiate this copy command every day. This is my current code from datetime import datetime, timedelta import dateutil.tz import psycopg2 from config import * def lambda_handler(event, context): con = psycopg2.connect(dbname=dbname, user=user, password=password, host=host, port=port) cur = con.cursor() try: query = """BEGIN TRANSACTION; COPY """ + table_name + """ FROM '"

How to import aws_lambda_permission in terraform

浪子不回头ぞ 提交于 2021-01-27 13:04:52
问题 How can I use terraform import with resources of type aws_lambda_permission in terraform? What should the second argument be? 回答1: At the time of writing Terraform does not have an importer for this resource, so it's not possible to import it automatically using the terraform import command. Since a Lambda permission is a subordinate resource belonging to a Lambda function, once there is support for importing it the most likely way it would be handled is to import it as a side-effect of