Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mvaldesdeleon/rds-reporting


https://github.com/mvaldesdeleon/rds-reporting

Last synced: about 6 hours ago
JSON representation

Awesome Lists containing this project

README

        

# RDS Reporting

The following scripts provide a mechanism to generate a CSV report of existing RDS instances across all accounts of an AWS Organization, and across the provided set of regions.

The report includes the following information:

| Name | Description | Example Value |
|-----------------------|----------------------------------------------------------------------|--------------------|
| AccountId | The 12-digit account number of the account that owns the instance | 123456789012 |
| Region | The region where the instnance is running | us-east-1 |
| DBInstanceIdentifier | The user-supplied database identifier | my-db-instance-1 |
| DBInstanceClass | The name of the compute and memory capacity class of the DB instance | db.m5.large |
| VCPUs | The number of vCPUs for the instance type | 2 |
| MemoryInGiB | The memory for the instance type | 8 |
| AllocatedStorageInGiB | The allocated storage size specified in gibibytes (GiB) | 20 |
| Engine | The name of the database engine to be used for this instance | aurora-postgresql |
| EngineVersion | The database engine version | 13.6 |
| LicenseModel | The license model information for this DB instance | postgresql-license |

# Install

Clone the repository, initialize a new [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment), and install the required dependencies.

```sh
python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
```

# Configure

Within the `get-instances-report.py` file, you will need to update the list of regions that you want to include, as well as the IAM Role that will be used for cross-account operations.

```py
# Update this with the list of regions you want to include in the report
REGIONS = ['eu-central-1', 'us-east-1']
# Update this with the cross-account role to be used
# Control Tower customers using Management Account credentials can leave this unchanged
EXECUTION_ROLE = 'AWSControlTowerExecution'
```

Update these to match your configuration.

# Generate the report

Using credentials from the AWS Organizations management account, you can run the `get-instances-report.py` script to generate the CSV report. This will be outputted directly to standard output, and can be redirected to a file as usual.

```sh
./get-instances-report.py > report.csv
```

# Apply updates en-masse

Using credentials from the AWS Organizations management account, you can run the `update-instances.py` script to apply updates to a set of instances en-masse. The list of instances needs to be provided as a CSV report via standard input. The report uses the same format as that which was generated by the `get-instances-report.py`, meaning you can use the same report as input after reviewing it and removing the instances you do not want to update.

**As provided, this script will only print out a list of the instances it would update, but it will not perform any modifications.** Before making any actual modifications, you will need to edit the `update-instances.py` file and uncomment the last line.

```sh
./update-instances.py < report.csv
```