aws-lambda

AWS Cognito with Serverless Local Environment

丶灬走出姿态 提交于 2021-02-16 18:06:46
问题 This is an issue we found on Github and are having the same issue: We're using serverless and serverless-offline to run lambda locally. We have a local DynamoDB implementation. For Cognito however, serverless-offline mocks the authenticated user and cognitoIdentityId. The mocked user has permission to invoke the lambda but not to pass in the cognitoIdentityId to match what we save in DynamoDB for a user. This may be a serverless-offline problem, and there may be other, better solutions. Or

AWS Cognito with Serverless Local Environment

让人想犯罪 __ 提交于 2021-02-16 18:06:38
问题 This is an issue we found on Github and are having the same issue: We're using serverless and serverless-offline to run lambda locally. We have a local DynamoDB implementation. For Cognito however, serverless-offline mocks the authenticated user and cognitoIdentityId. The mocked user has permission to invoke the lambda but not to pass in the cognitoIdentityId to match what we save in DynamoDB for a user. This may be a serverless-offline problem, and there may be other, better solutions. Or

AWS Cognito with Serverless Local Environment

人盡茶涼 提交于 2021-02-16 18:05:11
问题 This is an issue we found on Github and are having the same issue: We're using serverless and serverless-offline to run lambda locally. We have a local DynamoDB implementation. For Cognito however, serverless-offline mocks the authenticated user and cognitoIdentityId. The mocked user has permission to invoke the lambda but not to pass in the cognitoIdentityId to match what we save in DynamoDB for a user. This may be a serverless-offline problem, and there may be other, better solutions. Or

Unit tests panic when returning dereferenced struct attribute rather than struct

偶尔善良 提交于 2021-02-11 18:24:40
问题 How does one go about testing a function that is returning a struct attribute that is of type string or number, rather than the struct itself? I am trying to test the Lambda Code block with the Test Code block. In Lambda Code block below, I am returning *resp.UserPoolClient.ClientSecret which dereferences to a string , rather than the *string . When I run my test, I believe I get a panic error as *resp.UserPoolClient.ClientSecret is nil in the debugger. Is my returning of the de-referenced

Cannot revoke_ingress for non-default VPC with boto3

坚强是说给别人听的谎言 提交于 2021-02-11 17:19:27
问题 AWS Lambda / python 2.7 / boto3 I'm trying to revoke one rule out of many in a security group ( SG_we_are_working_with ) but receive error An error occurred (InvalidGroup.NotFound) when calling the RevokeSecurityGroupIngress operation: The security group 'sg-xxxxx' does not exist in default VPC 'none' The SG is really not in the default VPC but custom one, but I mention VPC id explicitly! SG_we_are_working_with = 'sg-xxxxx' SG_which_is_the_source_of_the_traffic = 'sg-11111111' VpcId = 'vpc

AWS Lambda packaging with dependencies

谁说我不能喝 提交于 2021-02-11 17:11:33
问题 Further outlining is in the context of NodeJS and Monorepo (based on Lerna). I have AWS stack with several AWS Lambda inside deployed by means of AWS CloudFormation. Some of the lambdas are simple (the single small module) and could be inlined: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Code.html#static-from-wbr-inlinecode const someLambda = new Function(this, 'some-lambda', { code: Code.fromInline(fs.readFileSync(require.resolve(<relative path to lambda module>),

AWS Lambda packaging with dependencies

筅森魡賤 提交于 2021-02-11 17:06:17
问题 Further outlining is in the context of NodeJS and Monorepo (based on Lerna). I have AWS stack with several AWS Lambda inside deployed by means of AWS CloudFormation. Some of the lambdas are simple (the single small module) and could be inlined: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.Code.html#static-from-wbr-inlinecode const someLambda = new Function(this, 'some-lambda', { code: Code.fromInline(fs.readFileSync(require.resolve(<relative path to lambda module>),

Not able to solve throttlingException in DynamoDB

喜夏-厌秋 提交于 2021-02-11 16:48:34
问题 I have a lambda function which does a transaction in DynamoDB similar to this. try { const reservationId = genId(); await transactionFn(); return { statusCode: 200, body: JSON.stringify({id: reservationId}) }; async function transactionFn() { try { await docClient.transactWrite({ TransactItems: [ { Put: { TableName: ReservationTable, Item: { reservationId, userId, retryCount: Number(retryCount), } } }, { Update: { TableName: EventDetailsTable, Key: {eventId}, ConditionExpression: 'available >

How to prevent devs to download lambda function?

梦想的初衷 提交于 2021-02-11 15:53:32
问题 I have some lambda functions and I usually grant access to thirds devs to my AWS account. They eventually can request my lambda functions for working or testing purposes but I want to prevent them to download the source code. Is there a way to manage who can download (or not) my lambda files ? 回答1: This will come down to the specifics of how they test the lambda; specially, how your lambda is configured and the users access permissions. Typically there is 3 scenarios that could play out here:

How to Process file on S3 event through AWS lambda using C#

扶醉桌前 提交于 2021-02-11 15:29:49
问题 I am looking for C# code blocks to read file from S3 on PUT event and upload the file to another bucket. I am fairly new to C# and see most of the blogs are either written for python and java. Any help will be highly appreciated. Thanks, 回答1: The flow would be: Configure an Amazon S3 Event to trigger the AWS Lambda function when a new object is created Details of the object created will be passed to the Lambda function via the event Your Lambda function should then call CopyObject() to