aws-serverless

Connecting to Aurora MySQL Serverless with Node

爷,独闯天下 提交于 2021-02-10 15:54:00
问题 I'm trying to connect to my Aurora Serverless MySQL DB cluster using the mysql module, but my connection always times out. const mysql = require('mysql'); //create connection const db = mysql.createConnection({ host : 'database endpoint', user : 'root', password : 'pass', database : 'testdb' }); //connect db.connect((err) => { if(err){ throw err; console.log('connection failed'); } console.log('mysql connected...'); }) db.end(); My cluster doesn't have a public IP address so I'm trying to use

Connecting to Aurora MySQL Serverless with Node

假装没事ソ 提交于 2021-02-10 15:53:19
问题 I'm trying to connect to my Aurora Serverless MySQL DB cluster using the mysql module, but my connection always times out. const mysql = require('mysql'); //create connection const db = mysql.createConnection({ host : 'database endpoint', user : 'root', password : 'pass', database : 'testdb' }); //connect db.connect((err) => { if(err){ throw err; console.log('connection failed'); } console.log('mysql connected...'); }) db.end(); My cluster doesn't have a public IP address so I'm trying to use

Enable CORS in AWS API Gateway with aws-cli

梦想与她 提交于 2021-02-10 07:37:07
问题 I'm currently writing script to programmatically enable CORS once a resource is added to an API Endpoint on AWS API Gateway. After exploring the put-integration-response function for hours. I almost got a breakthrough, but here is an error I'm getting: An error occurred (BadRequestException) when calling the PutIntegrationResponse operation: Invalid mapping expression specified: Validation Result: warnings : [], errors : [No method response exists for method.] Here is the script I'm using to

Serverless+Webpack: include .pem files in ZIP

僤鯓⒐⒋嵵緔 提交于 2021-02-08 10:57:29
问题 I try to deploy my lambda function to AWS using serverless. Everything works fine but the function cannot be executed because two files are not found (thats what fs.readFileSync says). I include them with the following lines in the serverless.yml: provider: name: aws runtime: nodejs10.x stage: dev region: eu-central-1 package: exclude: - .env include: - src/config/push-cert.pem - src/config/push-key.pem When I look in the .zip file which is uploaded to S3, both .pem files are not included. I

how to check if user already exist with same email or phone number while registration in Cognito user pool

馋奶兔 提交于 2021-02-08 10:46:48
问题 when new user register with same email and phone number user successfully registered in the Cognito user pool. so how can i check if user already exist with same email or phone number while registration in Cognito user pool This is my code for user registration in Cognito user pool result = client.sign_up( ClientId= clientId, Username= data['username'], Password= data['password'], UserAttributes=[ { 'Name': 'phone_number', 'Value': data['phone_number'], }, { 'Name': 'email', 'Value': data[

Using SAM file to remove default “Stages” in AWS ApiGateway?

ⅰ亾dé卋堺 提交于 2021-01-29 21:40:42
问题 I'm deploying a serverless application via Visual Studio using SAM file. At the end of the SAM file I've created a section of : "Type": "AWS::ApiGateway::Deployment" Which controls the deployment process : ,"APIGatewayDeploymenta727bb8729": { "Type": "AWS::ApiGateway::Deployment", "Properties": { "RestApiId": "3pb9y46oll", "Description": "....", "StageName": "Royi" <-----Notice here } } },... And Indeed , it creates a stage name : "Royi": But it also create two default stages named : "Prod &

Allow serverless lambda to be called by cloud watch

和自甴很熟 提交于 2021-01-28 05:45:16
问题 I have one lambda function within my serverless.yml . It looks somehow like this: functions: clean: handler: app.run events: - schedule: rate(2 hours) It works pretty well and out of the box lambda gets called every 2 hours. When I add new rule in AWS Console and sets the newly created lambda as a target it also works. Both AWS Console and Serverless framework creates on the background policy that events.amazonaws.com service can invoke this specific function. The policy looks somehow like

Adding XRAY Tracing to non-rest functions e.g., SQS, Cognito Triggers etc

假装没事ソ 提交于 2021-01-27 12:39:18
问题 Using the Serverless framework, I have functions that aren’t attached to an API Gateway Endpoint, such as: Cognito Triggers S3 Event DynamoDB Stream SQS Events I am also using XRAY tracing, which I have set as tracing: true in my serverless.yml file. It seems that these functions are not being traced, the debug message I receive is: Ignoring flush on subsegment 20dcd559aa2ab487. Associated segment is marked as not sampled. Is there any way to have these functions added, either via serverless

Adding XRAY Tracing to non-rest functions e.g., SQS, Cognito Triggers etc

廉价感情. 提交于 2021-01-27 12:34:51
问题 Using the Serverless framework, I have functions that aren’t attached to an API Gateway Endpoint, such as: Cognito Triggers S3 Event DynamoDB Stream SQS Events I am also using XRAY tracing, which I have set as tracing: true in my serverless.yml file. It seems that these functions are not being traced, the debug message I receive is: Ignoring flush on subsegment 20dcd559aa2ab487. Associated segment is marked as not sampled. Is there any way to have these functions added, either via serverless

Async Lambda Function: Returning promise or sending responseURL does not terminate CloudFormation custom resource invocation

 ̄綄美尐妖づ 提交于 2021-01-27 07:15:19
问题 I have a lambda function invoked as a custom resource via a CloudFormation template. It Creates/Deletes AWS Connect instances. The API calls work fine but I cannot seem to terminate the custom resource invocation, so the last CF block remains CREATE_IN_PROGRESS. No matter what I return from the async function it just won't terminate the CF execution with a success. I'm able to use a non-async handler successfully as in https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/walkthrough