/** * Retrieves the route tables in the specified VPC with a blocking request. * Failure triggers a SNS message to be published to the given topic. * @param {string} vpcId Previously validated VPC resource ID with a 'vpc-' prefix and either 8 or 17 character hexadecimal suffix. * @returns {object} Description of the route tables in the specified VPC. */ async function getRouteTableDescriptions(vpcId) { const params = { DryRun: false, Filters: [ { Name: 'vpc-id', Values: [vpcId], // Only evaluate route tables in the specified VPC }, ], }; const routeTableDescriptions = await ec2.describeRouteTables(params).promise() .catch((err) => { const params = { Subject: `FAILED: Describe route tables in VPC: '${vpcId}'`, Message: err.message, TopicArn: process.env.SNS_TOPIC_ARN }; sns.publish(params); }); return routeTableDescriptions; }