Search code examples
node.jsamazon-web-servicesamazon-dynamodbaws-secrets-manager

Fetching keys from AWS Secret Manager


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:

  1. access the dynamo db table with python script locally.
  2. 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:

  1. access the dynamodb table with chalice (an aws flask like microservice)
  2. 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.


Solution

  • 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.