Home > Software engineering >  How to allow a Tenant lambda function to query a dynamo table in Control Tower ROOT using NodeJs SDK
How to allow a Tenant lambda function to query a dynamo table in Control Tower ROOT using NodeJs SDK

Time:12-14

I have a Lambda Function running in a Tenant account that needs to query a DynamoDb Table B inside the Tenant and then query a DynamoDb Table A inside ROOT. This is the code I have so far:

'use strict';

const AWS = require('aws-sdk');
const ddbDc = new AWS.DynamoDB.DocumentClient()


module.exports.testDynamo = async event => {
  try {
    let result 
    let params = {}
    
    // Query Table B inside tenant
    params = {
      TableName: 'Table_B',
      Key: { externalKey : 'CA6E03C' }
    }
    result = await ddbDc.get(params).promise()
    console.log('           
  • Related