aws-sdk

Invoke function async on AWS Lambda

回眸只為那壹抹淺笑 提交于 2020-06-13 08:49:06
问题 I'm trying to invoke a function as async because I don't wan't to wait the response. I've read the AWS docs and there says to use InvocationType as Event but it only works if I do a .promise() . not working version : lambda.invoke({ FunctionName: 'rock-function', InvocationType: 'Event', Payload: JSON.stringify({ queryStringParameters: { id: c.id, template: c.csvTemplate } }) }) working version : lambda.invoke({ FunctionName: 'rock-function', InvocationType: 'Event', Payload: JSON.stringify({

Access Denied while sending email from AWS SES in Lambda function

佐手、 提交于 2020-06-11 16:24:25
问题 I am trying to send an email using Amazon SES in AWS Lambda function, For this i am facing the following error. AccessDenied: User arn:aws:sts::XXXXX:assumed-role/lambda_basic_execution/awslambda_XXXX' is not authorized to perform ses:SendEmail' on resource `arn:aws:ses:us-west-2:XXX:identity/example@example.com' I have granted permission for "ses:SendEmail", "ses:SendRawEmail" for the IAM role. 回答1: So, I was also having the same problem which Rakesh has explained but couldn't understand the

AWS - Cognito Authentication - Curl Call - Generate Token Without CLI - No Client Secret

ⅰ亾dé卋堺 提交于 2020-05-29 10:19:50
问题 I have created a API Gateway and I have applied Cognito Authentication there. Here to have the API Call work I am using AWS CLI to get Token , Here is my CLI Code aws cognito-idp admin-initiate-auth --user-pool-id us-west-2_leb660O8L --client-id 1uk3tddpmp6olkpgo32q5sd665 --auth-flow ADMIN_NO_SRP_AUTH --auth-parameters USERNAME=myusername,PASSWORD=mypassword Now I want to use CURL Call instead of this CLI Call. I have found the code but all needs client secret here. I do not have client

Why can my code run in a standard Node.js file, but not in a AWS Lambda Function?

寵の児 提交于 2020-05-29 09:08:26
问题 What I'm trying to do is create a lambda function where the function calls two commands on an ec2 instance. When I had trouble running this code in a lambda function, I removed the code from the exports.handler() method and ran the code in a standalone node.js file in the same ec2 instance and I was able to get the code to work. The command I ran was 'node app.js'. exports.handler = async (event) => { const AWS = require('aws-sdk') AWS.config.update({region:'us-east-1'}); var ssm = new AWS

AWS CDK user pool authorizer

别等时光非礼了梦想. 提交于 2020-05-25 17:52:45
问题 I'm trying to create an API gateway using the AWS-CDK and protect the REST endpoints with a Cognito user pool authorizer. I cannot find any examples how one would do this. I thought it should look something like this but maybe the methods I need do not exist? const cdk = require('@aws-cdk/cdk'); const lambda = require('@aws-cdk/aws-lambda'); const apigw = require('@aws-cdk/aws-apigateway'); const path = require('path'); // // Define the stack: class MyStack extends cdk.Stack { constructor

AWS CDK user pool authorizer

半城伤御伤魂 提交于 2020-05-25 17:49:37
问题 I'm trying to create an API gateway using the AWS-CDK and protect the REST endpoints with a Cognito user pool authorizer. I cannot find any examples how one would do this. I thought it should look something like this but maybe the methods I need do not exist? const cdk = require('@aws-cdk/cdk'); const lambda = require('@aws-cdk/aws-lambda'); const apigw = require('@aws-cdk/aws-apigateway'); const path = require('path'); // // Define the stack: class MyStack extends cdk.Stack { constructor

AWS-amplify Including the cognito Authorization header in the request

这一生的挚爱 提交于 2020-05-25 04:54:21
问题 I have create an AWS mobile hub project including the Cognito and Cloud logic. In my API gateway, I set the Cognito user pool for the Authorizers. I use React native as my client side app. How can I add the Authorization header to my API request. const request = { body: { attr: value } }; API.post(apiName, path, request) .then(response => { // Add your code here console.log(response); }) .catch(error => { console.log(error); }); }; 回答1: By default, the API module of aws-amplify will attempt

DynamoDB update does not console.log any output

[亡魂溺海] 提交于 2020-05-17 04:14:05
问题 I have the following code. This code is supposed to receive an SQS message, read the body, then update a dynamo record with the information contained within that body. The update is not working which is one issue, but even stranger I'm not getting any output from the dynamodb update. The last line of output is the console.log which details the SQS message, then the function ends. How is this possible? Shouldn't dynamo return some kind of output? console.log('Loading function'); const util =

Apache Ozone + AWS S3 .Net API: PutObject is creating a bucket instead of a key

拜拜、爱过 提交于 2020-05-16 02:27:51
问题 I am trying to create keys in apache OZone using AWS S3 API for .NET. The key I am trying to create must be inside a bucket called "test" that I created using AWS S3 CLI. My code: static async Task WriteFile() { AmazonS3Config config = new AmazonS3Config(); config.ServiceURL = "http://myApacheOzoneEndpoint:8744"; // This port is mapped from a docker container to (not the original endpoint port for Ozone) AWSCredentials credentials = new BasicAWSCredentials("testuser/scm@EXAMPLE.COM",

Apache Ozone + AWS S3 .Net API: PutObject is creating a bucket instead of a key

安稳与你 提交于 2020-05-16 02:27:43
问题 I am trying to create keys in apache OZone using AWS S3 API for .NET. The key I am trying to create must be inside a bucket called "test" that I created using AWS S3 CLI. My code: static async Task WriteFile() { AmazonS3Config config = new AmazonS3Config(); config.ServiceURL = "http://myApacheOzoneEndpoint:8744"; // This port is mapped from a docker container to (not the original endpoint port for Ozone) AWSCredentials credentials = new BasicAWSCredentials("testuser/scm@EXAMPLE.COM",