{"info":{"_postman_id":"935bf0bf-2830-5a1d-74a8-95e611787b11","name":"AWS RDS Audit","description":"<html><head></head><body><p>A simple collection to monitor RDS Instances. Introduced in <a href=\"http://blog.getpostman.com/2017/12/19/audit-your-aws-infrastructure-with-postman\">http://blog.getpostman.com/2017/12/19/audit-your-aws-infrastructure-with-postman</a>.</p>\n<p>Auditing database instances involves the following steps:</p>\n<ol>\n<li>Fetch all instances using the provided access key id and secret token.</li>\n<li>If there are additional instances to be fetched beyond the response of the first fetch request, extract the pagination token from the response and use it to repeat the fetch request.</li>\n<li>Once there are no more instances to be fetched, save the list of instances as an environment variable.</li>\n<li>Iterate over the list, repeating the configuration description request for each instance in the list. Once the config for an instance is known, compare it to a set of expected results to ensure compliance.</li>\n</ol>\n<p>PS: This collection is most useful when run as a <a href=\"https://www.getpostman.com/docs/postman/monitors/monitoring_apis_websites\">monitor</a>, so as to run such audits on a periodic basis. You can also configure the inbuilt Slack integration for Postman monitors, so as to recieve instance alerts when things are amiss.</p>\n<h1 id=\"required-environment-variables\">Required environment variables:</h1>\n<p>This collection requires the following environment variables:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th>Name</th>\n<th>Description</th>\n<th>Required</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>The access key id for the audit AWS user</td>\n<td>Yes</td>\n</tr>\n<tr>\n<td>key</td>\n<td>The secret access key for the audit AWS user</td>\n<td>Yes</td>\n</tr>\n<tr>\n<td>awsRegion</td>\n<td>The region to audit environments in. Defaults to us-east-1</td>\n<td>No</td>\n</tr>\n<tr>\n<td>maxRecords</td>\n<td>The number of environments to retrieve per fetch call. Defaults to 100 (max)</td>\n<td>No</td>\n</tr>\n</tbody>\n</table>\n</div></body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[{"content":"Required environment variables:","slug":"required-environment-variables"}],"owner":"2876480","collectionId":"935bf0bf-2830-5a1d-74a8-95e611787b11","publishedId":"7LjD4km","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2017-12-18T20:20:15.000Z"},"item":[{"name":"Describe RDS Instances","event":[{"listen":"prerequest","script":{"id":"9566e61b-6f7e-40c9-b3c0-ce355e58d03a","type":"text/javascript","exec":["var end,","    start,","    timestamp;","    msPerDay = 864e5; // milliseconds per day","","if (!(pm.environment.get('marker') && pm.environment.get('databases'))) {","    timestamp = new Date();","","    !pm.environment.get('maxRecords') && pm.environment.set('maxRecords', 100);","    !pm.environment.get('awsRegion') && pm.environment.set('awsRegion', 'us-east-1');","","    // set UTC milliseconds, seconds, minutes and hours to zero, effectively winding back to the start of the UTC day","    timestamp.setUTCMilliseconds(0);","    timestamp.setUTCSeconds(0);","    timestamp.setUTCMinutes(0);","    timestamp.setUTCHours(0);","","    pm.environment.set(\"secPerDay\", msPerDay / 1000);","    pm.environment.set('endTime', timestamp.toISOString());","    pm.environment.set('startTime', start = new Date(timestamp.valueOf() - msPerDay).toISOString());","","    pm.environment.set('marker', '');","    pm.environment.unset('databases');","","    console.info('Time range: ', start, '-', timestamp.toISOString());","}",""]}},{"listen":"test","script":{"id":"0ca48f26-4177-469f-be6a-010e937dabcb","type":"text/javascript","exec":["pm.test('should have a valid response', function () {","    pm.response.to.be.ok;","});","","var dbs,","    response = _.get(xml2Json(responseBody), 'DescribeDBInstancesResponse.DescribeDBInstancesResult'),","    marker = _.get(response, 'Marker', ''),","    databases = _.get(response, 'DBInstances.DBInstance', []);","","try {","    dbs = JSON.parse(pm.environment.get('databases') || '[]');","}","catch (e) { // if the pre-existing list of production databases is invalid, log the error and move on.","    console.log(e);","}","","dbs = _.isArray(dbs) ? dbs.concat(databases) : databases;","pm.environment.set('databases', JSON.stringify(dbs));","","// if a pagination marker is present, save it to an environment variable and loop back to the current request","if (marker) {","    pm.environment.set('marker', marker);","    postman.setNextRequest(request.name);","}","else {","    pm.environment.has('marker') && pm.environment.unset('marker');","}",""]}}],"id":"d33762c4-f9cb-1d5b-9304-6908780dbf4b","request":{"auth":{"type":"awsv4","awsv4":{"basicConfig":[{"key":"accessKey","value":"{{id}}"},{"key":"secretKey","value":"{{key}}"}],"advancedConfig":[{"key":"region","value":"{{awsRegion}}"},{"key":"service","value":"<service>"},{"key":"0","value":"<0>"},{"key":"1","value":"<1>"},{"key":"2","value":"<2>"},{"key":"3","value":"<3>"},{"key":"4","value":"<4>"},{"key":"5","value":"<5>"},{"key":"6","value":"<6>"},{"key":"7","value":"<7>"},{"key":"8","value":"<8>"},{"key":"9","value":"<9>"},{"key":"10","value":"<10>"},{"key":"11","value":"<11>"},{"key":"12","value":"<12>"},{"key":"13","value":"<13>"},{"key":"14","value":"<14>"},{"key":"15","value":"<15>"},{"key":"16","value":"<16>"},{"key":"17","value":"<17>"},{"key":"18","value":"<18>"},{"key":"19","value":"<19>"},{"key":"20","value":"<20>"},{"key":"21","value":"<21>"},{"key":"22","value":"<22>"},{"key":"23","value":"<23>"},{"key":"24","value":"<24>"},{"key":"25","value":"<25>"},{"key":"26","value":"<26>"},{"key":"27","value":"<27>"},{"key":"28","value":"<28>"},{"key":"29","value":"<29>"},{"key":"30","value":"<30>"},{"key":"31","value":"<31>"},{"key":"32","value":"<32>"},{"key":"33","value":"<33>"},{"key":"34","value":"<34>"},{"key":"35","value":"<35>"},{"key":"36","value":"<36>"},{"key":"37","value":"<37>"},{"key":"38","value":"<38>"},{"key":"39","value":"<39>"},{"key":"40","value":"<40>"},{"key":"41","value":"<41>"},{"key":"42","value":"<42>"},{"key":"43","value":"<43>"},{"key":"44","value":"<44>"},{"key":"45","value":"<45>"},{"key":"46","value":"<46>"},{"key":"47","value":"<47>"},{"key":"48","value":"<48>"},{"key":"49","value":"<49>"},{"key":"50","value":"<50>"},{"key":"51","value":"<51>"},{"key":"52","value":"<52>"},{"key":"53","value":"<53>"},{"key":"54","value":"<54>"},{"key":"55","value":"<55>"},{"key":"56","value":"<56>"},{"key":"57","value":"<57>"},{"key":"58","value":"<58>"},{"key":"59","value":"<59>"},{"key":"60","value":"<60>"},{"key":"61","value":"<61>"},{"key":"62","value":"<62>"},{"key":"63","value":"<63>"},{"key":"64","value":"<64>"},{"key":"65","value":"<65>"},{"key":"66","value":"<66>"},{"key":"67","value":"<67>"},{"key":"68","value":"<68>"},{"key":"69","value":"<69>"},{"key":"70","value":"<70>"},{"key":"71","value":"<71>"},{"key":"72","value":"<72>"},{"key":"73","value":"<73>"},{"key":"74","value":"<74>"},{"key":"75","value":"<75>"},{"key":"76","value":"<76>"},{"key":"77","value":"<77>"},{"key":"78","value":"<78>"},{"key":"79","value":"<79>"},{"key":"80","value":"<80>"},{"key":"81","value":"<81>"},{"key":"82","value":"<82>"},{"key":"83","value":"<83>"},{"key":"84","value":"<84>"},{"key":"85","value":"<85>"},{"key":"86","value":"<86>"},{"key":"87","value":"<87>"},{"key":"88","value":"<88>"},{"key":"89","value":"<89>"},{"key":"90","value":"<90>"},{"key":"91","value":"<91>"},{"key":"92","value":"<92>"},{"key":"93","value":"<93>"},{"key":"94","value":"<94>"},{"key":"95","value":"<95>"},{"key":"96","value":"<96>"},{"key":"97","value":"<97>"},{"key":"98","value":"<98>"},{"key":"serviceName","value":"<service-name>"}]},"isInherited":false},"method":"GET","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"},{"key":"X-Amz-Date","value":"20170420T144512Z"},{"key":"Authorization","value":"AWS4-HMAC-SHA256 Credential=AKIAJSC5VPELVYZXCMLA/20170420/us-east-1/rds/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=ebd34fffe1f5137e13831362cd9f151b222301ebc0c74948eb32b2ceabbba1ca"}],"url":"https://rds.{{awsRegion}}.amazonaws.com/?Operation=DescribeDBInstances&Version=2014-10-31&MaxRecords={{maxRecords}}&Marker={{marker}}","description":"<p>An <code>AWS Auth Signature</code> verified <code>GET</code> request to fetch all RDS instances under the Postman organization.</p>\n","urlObject":{"protocol":"https","path":[""],"host":["rds","{{awsRegion}}","amazonaws","com"],"query":[{"key":"Operation","value":"DescribeDBInstances"},{"key":"Version","value":"2014-10-31"},{"key":"MaxRecords","value":"{{maxRecords}}"},{"key":"Marker","value":"{{marker}}"}],"variable":[]}},"response":[],"_postman_id":"d33762c4-f9cb-1d5b-9304-6908780dbf4b"},{"name":"Get Metric Statistics: FreeStorageSpace","event":[{"listen":"prerequest","script":{"id":"9c1d4a90-9865-4347-b757-a11358f02e9c","type":"text/javascript","exec":["var db,","    databases;","","try {","    databases = JSON.parse(pm.environment.get('databases'));","    db = _.isFunction(databases.pop) && databases.pop();","","    // Set relevant identifiers for the current database","    pm.environment.set('db', JSON.stringify(db));","    pm.environment.set('dbIdentifier', db.DBInstanceIdentifier);","","    // update the databases list","    pm.environment.set('databases', JSON.stringify(databases));","} catch (e) {","    console.log(e);","}",""]}},{"listen":"test","script":{"id":"843d5957-75bb-478c-929e-bab7b0533d43","type":"text/javascript","exec":["pm.test('should have a valid response', function () {","    pm.response.to.be.ok;","});","","var freeBytes = _.get(xml2Json(responseBody), 'GetMetricStatisticsResponse.GetMetricStatisticsResult.Datapoints.member.Average');","","pm.environment.set('freeBytes', Number(freeBytes));",""]}}],"id":"1b445ca5-e719-5492-44d3-88a48741216d","request":{"auth":{"type":"awsv4","awsv4":{"basicConfig":[{"key":"accessKey","value":"{{id}}"},{"key":"secretKey","value":"{{key}}"}],"advancedConfig":[{"key":"region","value":"{{awsRegion}}"},{"key":"service","value":"<service>"},{"key":"0","value":"<0>"},{"key":"1","value":"<1>"},{"key":"2","value":"<2>"},{"key":"3","value":"<3>"},{"key":"4","value":"<4>"},{"key":"5","value":"<5>"},{"key":"6","value":"<6>"},{"key":"7","value":"<7>"},{"key":"8","value":"<8>"},{"key":"9","value":"<9>"},{"key":"10","value":"<10>"},{"key":"11","value":"<11>"},{"key":"12","value":"<12>"},{"key":"13","value":"<13>"},{"key":"14","value":"<14>"},{"key":"15","value":"<15>"},{"key":"16","value":"<16>"},{"key":"17","value":"<17>"},{"key":"18","value":"<18>"},{"key":"19","value":"<19>"},{"key":"20","value":"<20>"},{"key":"21","value":"<21>"},{"key":"22","value":"<22>"},{"key":"23","value":"<23>"},{"key":"24","value":"<24>"},{"key":"25","value":"<25>"},{"key":"26","value":"<26>"},{"key":"27","value":"<27>"},{"key":"28","value":"<28>"},{"key":"29","value":"<29>"},{"key":"30","value":"<30>"},{"key":"31","value":"<31>"},{"key":"32","value":"<32>"},{"key":"33","value":"<33>"},{"key":"34","value":"<34>"},{"key":"35","value":"<35>"},{"key":"36","value":"<36>"},{"key":"37","value":"<37>"},{"key":"38","value":"<38>"},{"key":"39","value":"<39>"},{"key":"40","value":"<40>"},{"key":"41","value":"<41>"},{"key":"42","value":"<42>"},{"key":"43","value":"<43>"},{"key":"44","value":"<44>"},{"key":"45","value":"<45>"},{"key":"46","value":"<46>"},{"key":"47","value":"<47>"},{"key":"48","value":"<48>"},{"key":"49","value":"<49>"},{"key":"50","value":"<50>"},{"key":"51","value":"<51>"},{"key":"52","value":"<52>"},{"key":"53","value":"<53>"},{"key":"54","value":"<54>"},{"key":"55","value":"<55>"},{"key":"56","value":"<56>"},{"key":"57","value":"<57>"},{"key":"58","value":"<58>"},{"key":"59","value":"<59>"},{"key":"60","value":"<60>"},{"key":"61","value":"<61>"},{"key":"62","value":"<62>"},{"key":"63","value":"<63>"},{"key":"64","value":"<64>"},{"key":"65","value":"<65>"},{"key":"66","value":"<66>"},{"key":"67","value":"<67>"},{"key":"68","value":"<68>"},{"key":"69","value":"<69>"},{"key":"70","value":"<70>"},{"key":"71","value":"<71>"},{"key":"72","value":"<72>"},{"key":"73","value":"<73>"},{"key":"74","value":"<74>"},{"key":"75","value":"<75>"},{"key":"76","value":"<76>"},{"key":"77","value":"<77>"},{"key":"78","value":"<78>"},{"key":"79","value":"<79>"},{"key":"80","value":"<80>"},{"key":"81","value":"<81>"},{"key":"82","value":"<82>"},{"key":"83","value":"<83>"},{"key":"84","value":"<84>"},{"key":"85","value":"<85>"},{"key":"86","value":"<86>"},{"key":"87","value":"<87>"},{"key":"88","value":"<88>"},{"key":"89","value":"<89>"},{"key":"90","value":"<90>"},{"key":"91","value":"<91>"},{"key":"92","value":"<92>"},{"key":"93","value":"<93>"},{"key":"94","value":"<94>"},{"key":"95","value":"<95>"},{"key":"96","value":"<96>"},{"key":"97","value":"<97>"},{"key":"98","value":"<98>"},{"key":"99","value":"<99>"},{"key":"100","value":"<100>"},{"key":"101","value":"<101>"},{"key":"102","value":"<102>"},{"key":"103","value":"<103>"},{"key":"104","value":"<104>"},{"key":"105","value":"<105>"},{"key":"serviceName","value":"<service-name>"}]},"isInherited":false},"method":"GET","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"},{"key":"X-Amz-Date","value":"20170410T084500Z"},{"key":"Authorization","value":"AWS4-HMAC-SHA256 Credential=AKIAJSC5VPELVYZXCMLA/20170410/us-east-1/monitoring/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=0559c1f9d1644bf191eebede289e40a21cff0d86fe3bb41c95294bf05bd5e3de"}],"url":"https://monitoring.{{awsRegion}}.amazonaws.com/?Dimensions.member.1.Name=DBInstanceIdentifier&Dimensions.member.1.Value={{dbIdentifier}}&MetricName=FreeStorageSpace&Namespace=AWS/RDS&Operation=GetMetricStatistics&Period={{secPerDay}}&Statistics.member.1=Average&Unit=Bytes&Version=2010-08-01&StartTime={{startTime}}&EndTime={{endTime}}","description":"<p>An <code>AWS Auth Signature</code> verified <code>GET</code> request to fetch the available free storage space (in bytes) for the current database instance. A threshold of &gt; 20% is enforced for best results.</p>\n","urlObject":{"protocol":"https","path":[""],"host":["monitoring","{{awsRegion}}","amazonaws","com"],"query":[{"key":"Dimensions.member.1.Name","value":"DBInstanceIdentifier"},{"key":"Dimensions.member.1.Value","value":"{{dbIdentifier}}"},{"key":"MetricName","value":"FreeStorageSpace"},{"key":"Namespace","value":"AWS/RDS"},{"key":"Operation","value":"GetMetricStatistics"},{"key":"Period","value":"{{secPerDay}}"},{"key":"Statistics.member.1","value":"Average"},{"key":"Unit","value":"Bytes"},{"key":"Version","value":"2010-08-01"},{"key":"StartTime","value":"{{startTime}}"},{"key":"EndTime","value":"{{endTime}}"}],"variable":[]}},"response":[],"_postman_id":"1b445ca5-e719-5492-44d3-88a48741216d"},{"name":"Check RDS Instance tags","event":[{"listen":"prerequest","script":{"id":"43be17da-d56b-41f6-945e-a1dc00c425d4","type":"text/javascript","exec":["var db;","","try {","    db = JSON.parse(pm.environment.get('db'));","} catch (e) {","    db = {};","}","","pm.environment.set('arn', db.DBInstanceArn);",""]}},{"listen":"test","script":{"id":"de07b54c-ea88-4a27-98d6-d4a5a3d8b8a2","type":"text/javascript","exec":["pm.test('should have a valid response', function () {","    pm.response.to.be.ok;","});","","var db,","    tags,","    isMysql,","    storage,","    secGroup,","    optGroup,","    databases,","    paramGroup,","    _tests = {}, // creating a separate object so that test results can be shown cleanly","    validOffset,","    rawBackupWindow,","    freeSpacePercent,","    backupWindowLength,","    rawMaintainenceWindow,","    maintainenceBackupOffset,","    maintainenceWindowLength,","    identifier = pm.environment.get('dbIdentifier'),","    freeBytes = Number(pm.environment.get('freeBytes')),","    rawTags = _.get(xml2Json(responseBody), 'ListTagsForResourceResponse.ListTagsForResourceResult.TagList.Tag'),","","    /**","     * Calculates the difference in minutes between two HH:MM timestamps.","     * ","     * @param {String[]} hm - An array of stringified timestamps in HH:MM format.","     * @returns {Number} - The absolute number of minutes between the two timestamps.","     */","    hmDiff = function (hm) {","        var one = hm[0].split(':').map(Number),","            two = hm[1].split(':').map(Number);","","        return Math.abs(one[0] - two[0]) * 60 + Math.abs(one[1] - two[1]);","    };","","try {","    db = JSON.parse(pm.environment.get('db'));","    _tests[`${identifier} has a valid data object`] = !_.isEmpty(db) && _.isObject(db);","","    isMysql = db.Engine === 'mysql';","    storage = Number(db.AllocatedStorage);","    isMaster = db.ReadReplicaSourceDBInstanceIdentifier;","} catch (e) {","    console.log(e);","    return (tests[`${identifier} has a valid data object`] = false); // if JSON.parse errors out, fail the actual tests (not _tests) and bail out","}","","_tests[`${identifier} Raw tag list is valid`] = !_.isEmpty(rawTags) && _.isArray(rawTags);","","tags = _.transform(rawTags, function (aggregator, tag) {","    aggregator[tag.Key] = tag.Value;","}, {});","","_tests[`${identifier} processed tags object is a valid, non-empty object`] = !_.isEmpty(tags) && _.isObject(tags);","","// Validate Cost Allocation Tags for the current database","// the tag names used in the `tags` object below might vary depending on your setup","_tests[`${identifier} name must be set (${tags.name})`] = tags.name;","_tests[`${identifier} type must be set (${tags.type})`] = tags.type;","_tests[`${identifier} environment must be set correctly (${tags.environment})`] = tags.environment;","","_tests[`${identifier} Total storage is a valid number (${storage} GB)`] = !isNaN(storage);","","if (isMysql) {","    _tests[`${identifier} Free space is a valid number (${freeBytes} bytes)`] = !isNaN(freeBytes);","","    freeSpacePercent = (freeBytes * 100) / (storage * 1024 * 1024 * 1024);","    _tests[`${identifier} has more than 20% free space (${freeSpacePercent.toFixed(2)} %)`] = freeSpacePercent > 20;","}","","_tests[`${identifier} is running (${db.DBInstanceStatus})`] = db.DBInstanceStatus === 'available';","_tests[`${identifier} has allocated storage >= 10 GB (${storage} GB)`] = storage >= 10;","isMaster && (_tests[`${identifier} has a valid instance class (${db.DBInstanceClass})`] = db.DBInstanceClass);","","_tests[`${identifier} uses valid db Engine (${db.Engine})`] = db.Engine;","_tests[`${identifier} has a valid engine version (${db.EngineVersion})`] = db.EngineVersion;","","_tests[`${identifier} database name is in lowercase, with letters and hyphens, and underscores only (${db.DBName})`] = /^[a-z-_]+$/.test(db.DBName);","","// you might also want to add a test to validate the naming convention for your RDS instances","// _tests[`${identifier} database name should be valid`] = identifier;","","_tests[`${identifier} has enhanced monitoring enabled (${db.MonitoringInterval})`] = db.MonitoringInterval !== '0';","_tests[`${identifier} has copy tags to snapshot enabled (${db.CopyTagsToSnapshot})`] = db.CopyTagsToSnapshot === 'true';","","if (isMaster) {","    isMysql && (_tests[`${identifier} has a backup retention period of one week or more (${db.BackupRetentionPeriod} days)`] = Number(db.BackupRetentionPeriod) >= 7);","","    if (db.PreferredBackupWindow) {","        rawBackupWindow = db.PreferredBackupWindow.split('-');","        backupWindowLength = hmDiff(rawBackupWindow);","","        _tests[`${identifier} has an automatic backup window of 1 hour if it is not read replica (${backupWindowLength} minutes)`] = backupWindowLength >= 60;","    }","    else {","        _tests[`${identifier} has an automatic backup window of 1 hour if it is not read replica`] = false;","    }","","    rawMaintainenceWindow = (db.PreferredMaintenanceWindow.match(/^[a-z]{3}:(\\d{2}:\\d{2})-[a-z]{3}:(\\d{2}:\\d{2})$/i)).slice(1, 3);","","    _tests[`${identifier} has auto minor version upgrades enabled (${db.AutoMinorVersionUpgrade})`] = db.AutoMinorVersionUpgrade === 'true';","    _tests[`${identifier} has auto minor version upgrades on Monday (${db.PreferredMaintenanceWindow})`] = /^mon:(\\d{2}:\\d{2})-mon:(\\d{2}:\\d{2})$/.test(db.PreferredMaintenanceWindow);","","    maintainenceWindowLength = hmDiff(rawMaintainenceWindow);","    _tests[`${identifier} has auto minor version upgrades for one hour (${maintainenceWindowLength} minutes)`] = maintainenceWindowLength >= 60;","","    maintainenceBackupOffset = hmDiff([rawMaintainenceWindow[0], rawBackupWindow[1]]);","    validOffset = maintainenceBackupOffset > 0;","    _tests[`${identifier} has maintainence scheduled after backup (maintainence is ${maintainenceBackupOffset} minutes ${validOffset ? 'after' : 'before' } backup)`] = validOffset;","}","","optGroup = _.get(db, 'OptionGroupMemberships.OptionGroupMembership.OptionGroupName');","_tests[`${identifier} has a valid option group (${optGroup})`] = optGroup;","","_tests[`${identifier} has multi AZ enabled (${db.MultiAZ})`] = db.MultiAZ === 'true';","","_tests[`${identifier} uses encrypted storage (${db.StorageEncrypted})`] = db.StorageEncrypted === 'true';","","paramGroup = _.get(db, 'DBParameterGroups.DBParameterGroup.DBParameterGroupName');","_tests[`${identifier} parameter group must be valid (${paramGroup})`] = paramGroup;","","_tests[`${identifier} should have a valid VPC configured (${db.DBSubnetGroup.VpcId})`] = db.DBSubnetGroup.VpcId;","","secGroup = _.get(db, 'VpcSecurityGroups.VpcSecurityGroupMembership', {});","","_tests[`${identifier} should use a valid security group (${secGroup.VpcSecurityGroupId})`] = secGroup.VpcSecurityGroupId;","_tests[`${identifier} security group should be active (${secGroup.Status})`] = secGroup.Status === 'active';","_tests[`${identifier} should not be publicly accessible (${db.PubliclyAccessible})`] = db.PubliclyAccessible === 'false';","","_tests[`${identifier} should have a valid master username (${db.MasterUsername})`] = db.MasterUsername;","","// filter down to all failed tests for the current database","_.assign(tests, _tests = _.reduce(_tests, function (result, value, key) {","    !value && (result[key] = value);","    return result;","}, {}));","","_.isEmpty(_tests) && (tests[`${identifier} passed all audit checks`] = true);","","try {","    databases = JSON.parse(pm.environment.get('databases'));","","    // do not fail tests for an empty array, as a check is made based on emptiness to stop or loop back for the next db","    tests['DB list is a valid array'] = _.isArray(databases);","}","catch (e) {","    tests['DB list is a valid array'] = false;","}","","postman.setNextRequest(_.isEmpty(databases) ? null : 'Get Metric Statistics: FreeStorageSpace');"]}}],"id":"571c2463-d50c-f61a-3a53-9c85752547fd","request":{"auth":{"type":"awsv4","awsv4":{"basicConfig":[{"key":"accessKey","value":"{{id}}"},{"key":"secretKey","value":"{{key}}"}],"advancedConfig":[{"key":"region","value":"{{awsRegion}}"},{"key":"service","value":"<service>"},{"key":"0","value":"<0>"},{"key":"1","value":"<1>"},{"key":"2","value":"<2>"},{"key":"3","value":"<3>"},{"key":"4","value":"<4>"},{"key":"5","value":"<5>"},{"key":"6","value":"<6>"},{"key":"7","value":"<7>"},{"key":"8","value":"<8>"},{"key":"9","value":"<9>"},{"key":"10","value":"<10>"},{"key":"11","value":"<11>"},{"key":"12","value":"<12>"},{"key":"13","value":"<13>"},{"key":"14","value":"<14>"},{"key":"15","value":"<15>"},{"key":"16","value":"<16>"},{"key":"17","value":"<17>"},{"key":"18","value":"<18>"},{"key":"19","value":"<19>"},{"key":"20","value":"<20>"},{"key":"21","value":"<21>"},{"key":"22","value":"<22>"},{"key":"23","value":"<23>"},{"key":"24","value":"<24>"},{"key":"25","value":"<25>"},{"key":"26","value":"<26>"},{"key":"27","value":"<27>"},{"key":"28","value":"<28>"},{"key":"29","value":"<29>"},{"key":"30","value":"<30>"},{"key":"31","value":"<31>"},{"key":"32","value":"<32>"},{"key":"33","value":"<33>"},{"key":"34","value":"<34>"},{"key":"35","value":"<35>"},{"key":"36","value":"<36>"},{"key":"37","value":"<37>"},{"key":"38","value":"<38>"},{"key":"39","value":"<39>"},{"key":"40","value":"<40>"},{"key":"41","value":"<41>"},{"key":"42","value":"<42>"},{"key":"43","value":"<43>"},{"key":"44","value":"<44>"},{"key":"45","value":"<45>"},{"key":"46","value":"<46>"},{"key":"47","value":"<47>"},{"key":"48","value":"<48>"},{"key":"49","value":"<49>"},{"key":"50","value":"<50>"},{"key":"51","value":"<51>"},{"key":"52","value":"<52>"},{"key":"53","value":"<53>"},{"key":"54","value":"<54>"},{"key":"55","value":"<55>"},{"key":"56","value":"<56>"},{"key":"57","value":"<57>"},{"key":"58","value":"<58>"},{"key":"59","value":"<59>"},{"key":"60","value":"<60>"},{"key":"61","value":"<61>"},{"key":"62","value":"<62>"},{"key":"63","value":"<63>"},{"key":"64","value":"<64>"},{"key":"65","value":"<65>"},{"key":"66","value":"<66>"},{"key":"67","value":"<67>"},{"key":"68","value":"<68>"},{"key":"69","value":"<69>"},{"key":"70","value":"<70>"},{"key":"71","value":"<71>"},{"key":"72","value":"<72>"},{"key":"73","value":"<73>"},{"key":"74","value":"<74>"},{"key":"75","value":"<75>"},{"key":"76","value":"<76>"},{"key":"77","value":"<77>"},{"key":"78","value":"<78>"},{"key":"79","value":"<79>"},{"key":"80","value":"<80>"},{"key":"81","value":"<81>"},{"key":"82","value":"<82>"},{"key":"83","value":"<83>"},{"key":"84","value":"<84>"},{"key":"85","value":"<85>"},{"key":"86","value":"<86>"},{"key":"87","value":"<87>"},{"key":"88","value":"<88>"},{"key":"89","value":"<89>"},{"key":"90","value":"<90>"},{"key":"91","value":"<91>"},{"key":"92","value":"<92>"},{"key":"93","value":"<93>"},{"key":"94","value":"<94>"},{"key":"95","value":"<95>"},{"key":"96","value":"<96>"},{"key":"97","value":"<97>"},{"key":"98","value":"<98>"},{"key":"serviceName","value":"<service-name>"}]},"isInherited":false},"method":"GET","header":[{"key":"Content-Type","value":"application/x-www-form-urlencoded"},{"key":"X-Amz-Date","value":"20170410T102349Z"},{"key":"Authorization","value":"AWS4-HMAC-SHA256 Credential=AKIAJSC5VPELVYZXCMLA/20170410/us-east-1/rds/aws4_request, SignedHeaders=content-type;host;x-amz-date, Signature=8c2697df4051204e79c2fc126caf0d6165d1df297a187503feccd993676279e0"}],"url":"https://rds.{{awsRegion}}.amazonaws.com/?Operation=ListTagsForResource&Version=2014-10-31&ResourceName={{arn}}","description":"<p>An <code>AWS Auth Signature</code> verified <code>GET</code> request to check all RDS instance tags under the Postman organization.</p>\n","urlObject":{"protocol":"https","path":[""],"host":["rds","{{awsRegion}}","amazonaws","com"],"query":[{"key":"Operation","value":"ListTagsForResource"},{"key":"Version","value":"2014-10-31"},{"key":"ResourceName","value":"{{arn}}"}],"variable":[]}},"response":[],"_postman_id":"571c2463-d50c-f61a-3a53-9c85752547fd"}],"event":[{"listen":"prerequest","script":{"id":"6bd20ca4-face-4048-8262-732f508659fa","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"5c61797e-f633-4d5f-8e30-76651e7a4c97","type":"text/javascript","exec":[""]}}]}