Fetching keys from AWS Secret Manager - node.js

I am trying to fetch my Secret keys and Id( to access aws dynamo db ) from AWS Sceret Manager.
What I am able to do:
access the dynamo db table with python script locally.
access the dynamo db table with python flask local server.
(This case it can do because .. i think .. it is able to fetch my details from the aws/credentials )
What I am not able to do:
access the dynamodb table with chalice (an aws flask like microservice)
access the dynamo db table from my Nodejs project locally.
What I want to do:
I have a website code written(in nodejs) and deployed(with aws). now I want to access the aws dynamo db from my nodejs code (which I was not able to do) even locally.
So I thought of making a python Api and deploy in AWS and then access the api end point from node. BUt I couldn't access the dynamo db from the chalice api Chalice.
If there is way to access the credentials from nodejs and if it even works when deployed. It would be amazing.
If you find this question not appropriate please correct me. I am noob in this.
Thank you in advance.

Where is your code actually running? EC2? Why not create a role for your EC2 instance and grant it the appropriate DynamoDB permissions through the role?
It's not good practice to store AWS IAM credentials in Secrets Manager when you can just grant permissions through roles.

Related

AWS Lambda Node. Js How to use Secrets Manager to connect to the database

I created a PostgreSQL database instance in the AWS console, and then created a user name and password for Secrets Manager to manage the PostgreSQL database,Please tell me about the node in lambda Js how to use Secrets Manager to connect to the database and query. I'm a novice, and I'm confused about how to implement this function. Thank you very much

How to look up AWS Document DB using Terraform AWS Provider?

With an RDS instance, metadata regarding the instance can be obtained via terraform scripts using aws_db_instance data source. However, this doesn't exist for document db. My goal is to look up the endpoint of a document DB by its name. Does anyone know how this can be done?

How to run RDS SQL Server select queries in AWS lambda using boto3 RDS client python?

I am going through AWS boto3 rds documentation for running sql select query on table which is present in RDS SQL Server using python in AWS lambda, but I didn't find any info. Don't we have any option to run RDS SQL queries in AWS lambda? Any ideas!
rds_client = boto3.client('rds')
boto3 library provides API to communicate with AWS API. The AWS RDS API includes of
Listing all RDS Instances
Create new RDS Instances
Stop RDS Instances
Modify RDS Instances
etc
For Lambda or any programming language to communicate with database server, we first need to install database driver. Think of it as a middle-man (drivers) that collect instructions of programming language, convert it to database understandable language, then database to process it and return the information to the middle-man, and middle-man translate it to something your programming language can understand. Boto3 does not come with any relational database drivers.
To allow Lambda to work your RDS SQL Server, you have to install Python's SQL Server driver and upload to Lambda. You can either package it as a standalone zip or make it as a Lambda Layer that can be used across by multiple Lambda Functions. The commonly used SQL Server driver for python is pyodbc
Someone on medium.com have make a blogpost about this.

How to import data into a Salesforce sandbox from a Snowflake database or AWS S3 by API and Python code?

I want to load data into a Salesforce sandbox from a Snowflake database (or from AWS S3) using Python.
Could you please let me know of any way to connect to Salesforce sandbox from an AWS EC2 instance?
We used to do this at a company I worked for in the past. We used a combination of Apache Airflow (for orchestration) and the Simple-Salesforce as the python library.

Amazon RDS - How to Create new DB using PHP API?

In a SAAS app, written in PHP, how to create a new mysql database in an existing RDS instance?
The documentation for php api here:
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-rds.html
doesn't show any such function available under available operations section at the bottom.
How do we do that??
There is no such option provided in RDS API. When you call CreateDBInstance API, you can specify the DBName but that is at the time of creating a new RDS instance. Once you have created the instance, then there is no provision to create a new DB on it.
I would imagine you need to connect via PHP using ODBC (or whatever that PHP supports) to the RDS endpoint and then create a new DB just like you are connecting to a non-RDS remote DB.

Resources