Questions tagged with Amazon DocumentDB

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Lambda nodejs cant connect to documentDB

Good morning all, I'm trying to connect with NodeJs to my documentdb cluster with mongoose without ssl: I get {"message":"Internal server error"} with ssl i get pem file not found {"message":"ENOENT: no such file or directory, open '/var/task/rds-combined-ca-bundle.pem'"} Here is my code with ssl ``` import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda' import mongoose = require('mongoose') import fs = require("fs") import path = require("path") export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => { let response: APIGatewayProxyResult; try { const filePath = path.join(__dirname, 'rds-combined-ca-bundle.pem') const databaseUri = 'mongodb://myuser:mypassword@mycluster.docdb.amazonaws.com:27017/?ssl=true&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false' const client = await mongoose.connect(databaseUri, { ssl: true, sslValidate: false, sslCA: filePath, useNewUrlParser: true, useUnifiedTopology: true }) // Return result response = { statusCode: 200, body: JSON.stringify({ test: 'test mongoose', client: client }) } } catch (err: unknown) { console.log('4',err) response = { statusCode: 500, body: JSON.stringify({ message: err.message }) } } return response; } ``` Here is my code without ssl ``` import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda' import mongoose = require('mongoose') export const lambdaHandler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => { let response: APIGatewayProxyResult; try { const client = await mongoose.connect( 'mongodb://myuser:mypassword@mycluster.docdb.amazonaws.com:27017/sample-database?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false', { useNewUrlParser: true }) //Return result response = { statusCode: 200, body: JSON.stringify({ test: 'test mongoose', client: client }) } } catch (err: unknown) { console.log('4',err) response = { statusCode: 500, body: JSON.stringify({ message: err.message }) } } return response; } ``` Could you help me ? thank you sincerely
1
answers
0
votes
39
views
asked 11 days ago

Failed to stabilize Instance with id

I have this problem: Failed to stabilize Instance with id. My CF looks like: Resources: DocumentDBSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupName: 'DocumentDB SG' GroupDescription: !Sub 'Security Group for the DocumentDb' VpcId: !Ref VPC DocumentDBSubnetGroup: Type: AWS::DocDB::DBSubnetGroup Properties: DBSubnetGroupDescription: "Subnet group for Document DB cluster" DBSubnetGroupName: "document-db-subnet-group" SubnetIds: !Ref PrivateSubnetIds DocumentDBParameterGroup: Type: AWS::DocDB::DBClusterParameterGroup Properties: Description: "Parameter group for Document DB cluster" Family: docdb4.0 Name: "document-db-paramater-group" Parameters: audit_logs: "disabled" DocumentDBCluster: Type: AWS::DocDB::DBCluster Properties: BackupRetentionPeriod: 7 DBClusterIdentifier: "docdb" DBSubnetGroupName: !Ref DocumentDBSubnetGroup DBClusterParameterGroupName: !Ref DocumentDBParameterGroup Port: 27017 PreferredBackupWindow: "07:00-09:30" PreferredMaintenanceWindow: "tue:07:00-tue:11:00" VpcSecurityGroupIds: - !Ref DocumentDBSecurityGroup StorageEncrypted: true DocumentDBInstance: Type: AWS::DocDB::DBInstance DependsOn: - DocumentDBCluster Properties: DBClusterIdentifier: !Ref DocumentDBCluster DBInstanceClass: db.t3.medium DBInstanceIdentifier: "docdb" PreferredMaintenanceWindow: "tue:07:00-tue:11:00" If i search this problem i find information about RDS (snapshot), but i don't use snapshot in this deployment..
1
answers
0
votes
31
views
Yurii
asked 2 months ago