Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi region replica strike implementation #3

Merged
merged 4 commits into from
Oct 26, 2023

Conversation

grudra7714
Copy link
Member

This adds the strike for checking the specified rds has a multi region read replica created or not.
Did some code reconfiguration for common functions

Also added a map of aws regions to its abbreviations because of the output from the DescribeDBInstanceAutomatedBackups function

Checked against the privateer binary as well

Copy link
Member

@krumware krumware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the rdsClient.DescribeDBInstanceAutomatedBackups in the multiregion.go. Is that meant to be there?

@grudra7714
Copy link
Member Author

I noticed the rdsClient.DescribeDBInstanceAutomatedBackups in the multiregion.go. Is that meant to be there?

No, i had the logic wrong for it. Fixed it

@grudra7714
Copy link
Member Author

raidname: RDS-CCC-Taxonomy
starttime: 2023-10-24 12:28:53.658616797 -0400 EDT m=+0.004190604
endtime: 2023-10-24 12:28:55.097862169 -0400 EDT m=+1.443435990
strikeresults:
    AutomatedBackups:
        passed: true
        description: Check for automated backups against the specified RDS instance
        message: Completed Successfully
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            CheckForDBInstance:
                passed: true
                description: Check if the instance is available/exists
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSInstanceMovement
                value: null
            CheckForDBInstanceAutomatedBackups:
                passed: true
                description: Check if the instance has automated backups enabled
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSAutomatedBackupMovement
                value: null
    MultiRegion:
        passed: false
        description: Check if AWS RDS instance has multi region. This strike only checks for a read replica in a seperate region
        message: Multi Region instances not found
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            CheckForDBInstance:
                passed: true
                description: Check if the instance is available/exists
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSInstanceMovement
                value: null
            CheckForMultiRegionDBInstances:
                passed: false
                description: Check if the instance has multi region enabled
                message: Multi Region instances not found
                function: github.com/krumIO/raid-rds/strikes.checkRDSMultiRegionMovement
                value: null
    SQLFeatures:
        passed: true
        description: This will perform various SQL queries
        message: Completed Successfully
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            ConnectToDB:
                passed: true
                description: The database host must be available and accepting connections
                message: ""
                function: github.com/krumIO/raid-rds/strikes.connectToDb
                value: null
            CreateTable:
                passed: true
                description: A table can be created in the database
                message: ""
                function: github.com/krumIO/raid-rds/strikes.createTable
                value: null

The db I used didnt had a multi region setup so it failed as expected

if viper.IsSet("raids.RDS.aws.config.instance_identifier") {
return viper.GetString("raids.RDS.aws.config.instance_identifier"), nil
}
return "", errors.New("database instance identifier must be set in the config file")
}

func getHostRDSRegion() (string, error) {
if viper.IsSet("raids.RDS.aws.config.region") {
return viper.GetString("raids.RDS.aws.config.region"), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably for a later PR, but RDS is specifically Amazon, right? If anything, we'd probably do raids.aws.rds... 🤔 Noting this for later discussion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was more so reading this as raiding a database against different cloud provider. RDS term is aws specific, you are right, maybe we change that to DB or RDMS in a later pr. Also noting that we need to change the repo name as well

example-config.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@eddie-knight eddie-knight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though I added a couple questions in the comments for consideration

@grudra7714
Copy link
Member Author

Updated

raidname: RDS-CCC-Taxonomy
starttime: 2023-10-26 10:21:06.457494506 -0400 EDT m=+0.005522033
endtime: 2023-10-26 10:21:09.249986174 -0400 EDT m=+2.798013762
strikeresults:
    AutomatedBackups:
        passed: true
        description: Check for automated backups against the specified RDS instance
        message: Completed Successfully
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            CheckForDBInstance:
                passed: true
                description: Check if the instance is available/exists
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSInstanceMovement
                value: null
            CheckForDBInstanceAutomatedBackups:
                passed: true
                description: Check if the instance has automated backups enabled
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSAutomatedBackupMovement
                value: null
    MultiRegion:
        passed: false
        description: Check if AWS RDS instance has multi region. This strike only checks for a read replica in a seperate region
        message: Multi Region instances not found
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            CheckForDBInstance:
                passed: true
                description: Check if the instance is available/exists
                message: ""
                function: github.com/krumIO/raid-rds/strikes.checkRDSInstanceMovement
                value: null
            CheckForMultiRegionDBInstances:
                passed: false
                description: Check if the instance has multi region enabled
                message: Multi Region instances not found
                function: github.com/krumIO/raid-rds/strikes.checkRDSMultiRegionMovement
                value: null
    SQLFeatures:
        passed: true
        description: This will perform various SQL queries
        message: Completed Successfully
        docsurl: https://www.github.com/krumIO/raid-rds
        controlid: CCC-Taxonomy-1
        movements:
            ConnectToDB:
                passed: true
                description: The database host must be available and accepting connections
                message: ""
                function: github.com/krumIO/raid-rds/strikes.connectToDb
                value: null
            CreateTable:
                passed: true
                description: A table can be created in the database
                message: ""
                function: github.com/krumIO/raid-rds/strikes.createTable
                value: null

@grudra7714 grudra7714 merged commit 71a3f4d into main Oct 26, 2023
1 check passed
@grudra7714 grudra7714 deleted the feat/multi-region branch October 26, 2023 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants