aws-lambda

AWS Cloud9: Referencing Lambda Layer Locally

好久不见. 提交于 2020-02-21 10:49:08
问题 I have set-up a Cloud9 environment to develop and test lambda functions. To make the environment "cleaner" I have opted to use lambda layers to specify the function's dependencies. By doing this, I have removed the dependency folders from the environment, but I am now unable to test locally. For example, I have a lambda layer for Stripe's python library. I am able to write a lambda function in Cloud9 referencing stripe, deploy the function, and successfully test the function remotely. But i

AWS Lambda ERROR: AttributeError 'list' object has no attribute 'get'

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-16 09:54:29
问题 I have a Lambda function that is designed to turn ON/OFF my Philip HUE lightbulbs. I am able to execute the python script & it runs (error-free) on my local machine. However, when I trigger the Lambda function (using an IoT Button) I get the following error message. [ERROR] AttributeError: 'list' object has no attribute 'get' Traceback (most recent call last): File "/var/task/lambda_function.py", line 21, in lambda_handler bulbStatus = nested_get(data,["state","on"]) File "/var/task/lambda

How to run a C++ AWS Lambda Function locally with SAM?

╄→гoц情女王★ 提交于 2020-02-07 04:25:20
问题 I would like to try the custom C++ runtime for AWS Lambda and testing it locally using SAM. Unfortunately I get the error Runtime exited without providing a reason (compare error details below). How can I run C++ Lambda functions locally with SAM? Approach: I am following the exact steps described in official C++ Introduction blog, up to the last step of "Create your C++ function". The rest of the blog is about deploying the function on Lambda (which I DO NOT want to do, since I would like to

How to access aws resources created in other account

让人想犯罪 __ 提交于 2020-02-07 02:37:07
问题 In my use case, I want to access DynamoDB table created in AWS account A and Lambda created in account B. For this I have followed many references on Internet which suggests me to use AWS assume role feature. I have added following permission in Lambda execution role { "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Action": "sts:AssumeRole", "Resource": "arn:aws:iam::aws-account-A-number:role/test-db-access" } } Following is the trust relationship of Lambda { "Version": "2012-10

accessing s3 from lambda within VPC in aws-go-sdk

我的未来我决定 提交于 2020-02-06 04:34:14
问题 I'm just started on using aws-sdk-go and notice that the s3 requests are using http/https rather than s3 protocol. How can I read the object in s3 from my lambda within vpc using aws-sdk-go? And I don't want to use NAT Gateway. I can do this in NodeJS but is there any way for aws-go-sdk to do the same? Thanks! 回答1: To access S3 within a VPC without an internet gateway you need to use a S3 Endpoint 回答2: This code snippet shows how to use aws-go-sdk to list S3 buckets for region us-east-1

accessing s3 from lambda within VPC in aws-go-sdk

最后都变了- 提交于 2020-02-06 04:33:28
问题 I'm just started on using aws-sdk-go and notice that the s3 requests are using http/https rather than s3 protocol. How can I read the object in s3 from my lambda within vpc using aws-sdk-go? And I don't want to use NAT Gateway. I can do this in NodeJS but is there any way for aws-go-sdk to do the same? Thanks! 回答1: To access S3 within a VPC without an internet gateway you need to use a S3 Endpoint 回答2: This code snippet shows how to use aws-go-sdk to list S3 buckets for region us-east-1

How to configure credential rotation in AWS Secret Manager?

非 Y 不嫁゛ 提交于 2020-02-05 04:26:16
问题 I read this article about how to implement the credential rotation, I know I could just configure this in 'Edit rotation configuration' option, but the thing is my current secret is in use, and I notice that it says 'Enable automatic rotation - Recommended when your applications are not using this secret yet', how can I enable the rotation then? My database is using RDS Aurora MySQL engine and I want it to rotate every 7 days. I also read this document, does it mean I must have an IAM role

Unable to load file from resources folder when running app locally

穿精又带淫゛_ 提交于 2020-02-05 04:06:08
问题 Using Java 8, I have an AWS lambda function that has a flat file in the src/main/resources folder. When running on AWS, I'm having no issues. But when I run locally, my app can't find the file. Here is what my code looks like: ClassLoader classLoader = getClass().getClassLoader(); URL url = classLoader.getResource( "./resources/forms/myform.pdf" ); This works fine for loading it when it runs as an AWS lambda, but does not work locally. When running locally, the url variable is null. When I

Unable to load file from resources folder when running app locally

巧了我就是萌 提交于 2020-02-05 04:05:32
问题 Using Java 8, I have an AWS lambda function that has a flat file in the src/main/resources folder. When running on AWS, I'm having no issues. But when I run locally, my app can't find the file. Here is what my code looks like: ClassLoader classLoader = getClass().getClassLoader(); URL url = classLoader.getResource( "./resources/forms/myform.pdf" ); This works fine for loading it when it runs as an AWS lambda, but does not work locally. When running locally, the url variable is null. When I

How to update a AWS::Lambda::Version always to $LATEST in a CF template

大憨熊 提交于 2020-02-04 06:42:30
问题 I have a Cloudformation template with a Lambda@Edge function. This means I need the lambda function, and a Version (type WS::Lambda::Version). Now, the first time I create the CF template, it works. But when I update the CF template and the Lambda function is updated, the Lambda version does not get updated (kind of makes sense, it did not change!). How can I force the Lambda version to update when the Lambda function updates? 回答1: You can create a script that edits the template before