aws-lambda

How to get AWS S3 object Location/URL using pyhton 3.8?

為{幸葍}努か 提交于 2020-12-13 03:20:40
问题 I am uploading a file to AWS S3 using AWS Lambda function (Python3.8) with the following code. file_obj = open(filename, 'rb') s3_upload = s3.put_object( Bucket="aaa", Key="aaa.png", Body=file_obj) return { 'statusCode': 200, 'body': json.dumps("Executed Successfully") } I want to get the location/url of the S3 object in return . In Node.js we use the .location parameter for getting the object location/url. Any idea how to do this using python 3.8? 回答1: The url of S3 objects has known format

How to get AWS S3 object Location/URL using pyhton 3.8?

自闭症网瘾萝莉.ら 提交于 2020-12-13 03:19:52
问题 I am uploading a file to AWS S3 using AWS Lambda function (Python3.8) with the following code. file_obj = open(filename, 'rb') s3_upload = s3.put_object( Bucket="aaa", Key="aaa.png", Body=file_obj) return { 'statusCode': 200, 'body': json.dumps("Executed Successfully") } I want to get the location/url of the S3 object in return . In Node.js we use the .location parameter for getting the object location/url. Any idea how to do this using python 3.8? 回答1: The url of S3 objects has known format

Accessing AWS SSM Parameters in NodeJS Lambas

拥有回忆 提交于 2020-12-12 12:22:48
问题 I am able to retrieve data from the AWS SSM Parameter Store locally in NodeJS but am unable to when I move my code to Lambdas. I've hunted and not found many examples of setting up Lambdas with NodeJS that aren't using the "Serverless" framework. I know I'm missing something simple. I just don't know what yet. I've given my lambda's IAM policy these permissions: "Effect": "Allow", "Action": [ "ssm:PutParameter", "ssm:GetParameter" ], "Resource": [ "arn:aws:ssm:region:account-id:parameter/Name

How to bundle headless chromium module with AWS Lambda?

回眸只為那壹抹淺笑 提交于 2020-12-12 10:25:28
问题 I'm attempting to use Puppeteer with Lambda, however, on serverless deploy, the lambda errors out due to exceeding the 250mb unbundled package size limit. So, to get under the limit, I've switched to Puppeteer core which doesn't come packaged with chromium. This requires referencing a path to an executable to launch chrome. (e.g. puppeteer.launch({executablePath: headlessChromiumPath}) ); However, I'm not sure how to load a headless Chromium into my container so that I can later reference it.

API Versioning with AWS API Gateway

丶灬走出姿态 提交于 2020-12-12 09:52:07
问题 I am having trouble implementing a viable versioning scenario with API Gateway + Lambda. My requirement is to have major versioning at the API level but then minor versioning at the service level. My environments are also spread across accounts so staging is not an option for env propagation. Has anyone had success implementation API management with AWS API Gateway? 回答1: In API Gateway, major versions should be represented by separate APIs. You can use the custom domain feature to map base

API Versioning with AWS API Gateway

这一生的挚爱 提交于 2020-12-12 09:51:34
问题 I am having trouble implementing a viable versioning scenario with API Gateway + Lambda. My requirement is to have major versioning at the API level but then minor versioning at the service level. My environments are also spread across accounts so staging is not an option for env propagation. Has anyone had success implementation API management with AWS API Gateway? 回答1: In API Gateway, major versions should be represented by separate APIs. You can use the custom domain feature to map base

Connecting to DocumentDB from AWS Lambda using Python

▼魔方 西西 提交于 2020-12-12 09:44:20
问题 I am trying to connect to DocumentDB from a Lambda function. I have configured my DocumentDB as per this tutorial and can access it through the cloud9 command prompt. The documentDB cluster is part of two security groups. The first security group is called demoDocDB and the second called default and is the vpc defulat security group. The inbound rules for demoDocDB forward requests from the cloud9 instance to port 27017 where my documentDB database is running. The inbound rules for the

Connecting to DocumentDB from AWS Lambda using Python

落花浮王杯 提交于 2020-12-12 09:38:51
问题 I am trying to connect to DocumentDB from a Lambda function. I have configured my DocumentDB as per this tutorial and can access it through the cloud9 command prompt. The documentDB cluster is part of two security groups. The first security group is called demoDocDB and the second called default and is the vpc defulat security group. The inbound rules for demoDocDB forward requests from the cloud9 instance to port 27017 where my documentDB database is running. The inbound rules for the

Connecting to DocumentDB from AWS Lambda using Python

血红的双手。 提交于 2020-12-12 09:38:32
问题 I am trying to connect to DocumentDB from a Lambda function. I have configured my DocumentDB as per this tutorial and can access it through the cloud9 command prompt. The documentDB cluster is part of two security groups. The first security group is called demoDocDB and the second called default and is the vpc defulat security group. The inbound rules for demoDocDB forward requests from the cloud9 instance to port 27017 where my documentDB database is running. The inbound rules for the

AWS Lambda Create Function - Request failed with status code 403

巧了我就是萌 提交于 2020-12-12 06:48:45
问题 Trying to create a new AWS Lambda Function with the root account for the first time using management console. I am receiving the error "Request failed with status code 403" no matter how many different options I tried. I've already tried changing my region, creating the function with default role(basic lambda permissions), new role, existing role and with the options "Author from Scratch", "Use a blueprint", "Serverless app repository" but still getting the same error. How can i troubleshoot