- What is awsx-rds
- How to write plugin subcommand
- How to build / Test
- what it does
- command input
- command output
- How to run
This is a plugin subcommand for awsx cli ( https://github.com/Appkube-awsx/awsx#awsx ) cli.
For details about awsx commands and how its used in Appkube platform , please refer to the diagram below:
This plugin subcommand will implement the Apis' related to RDS services , primarily the following API's:
- getConfigData
This cli collect data from metric / logs / traces of the RDS services and produce the data in a form that Appkube Platform expects.
This CLI , interacts with other Appkube services like Appkube vault , Appkube cloud CMDB so that it can talk with cloud services as well as filter and sort the information in terms of product/env/ services, so that Appkube platform gets the data that it expects from the cli.
Please refer to the instaruction - https://github.com/Appkube-awsx/awsx#how-to-write-a-plugin-subcommand
It has detailed instruction on how to write a subcommand plugin , build/test/debug/publish and integrate into the main commmand.
go run main.go
- Program will print Calling aws-cloudelements on console
Another way of testing is by running go install command
go install
- go install command creates an exe with the name of the module (e.g. awsx-rds) and save it in the GOPATH
- Now we can execute this command on command prompt as below
awsx-rds getConfigData --zone=us-east-1 --accessKey=xxxxxxxxxx --secretKey=xxxxxxxxxx --crossAccountRoleArn=xxxxxxxxxx --externalId=xxxxxxxxxx
This subcommand implement the following functionalities - getConfigData - It will get the resource metadata for a given AWS account id and region.
- --valutURL = URL location of vault - that stores credentials to call API
- --acountId = The AWS account id.
- --zone = AWS region
- --accessKey = Access key for the AWS account
- --secretKey = Secret Key for the Aws Account
- --crossAccountRoleArn = Cross Acount Rols Arn for the account.
- --external Id = The AWS External id.
- --dbInstanceIdentifier= Insert dbInstanceIdentifier in RDS from aws account.
DBInstances: [{ ActivityStreamStatus: "stopped", AllocatedStorage: 20, AutoMinorVersionUpgrade: true, AvailabilityZone: "us-east-1a", BackupRetentionPeriod: 7, BackupTarget: "region", CACertificateIdentifier: "rds-ca-2019", CertificateDetails: { CAIdentifier: "rds-ca-2019", ValidTill: 2024-08-22 17:08:50 +0000 UTC }, DBInstanceArn: "arn:aws:rds:us-east-1:657907747545:db:postgresql", DBInstanceClass: "db.t4g.medium", DBInstanceIdentifier: "postgresql", }]
From main awsx command , it is called as follows:
awsx-rds --zone=us-east-1 --accessKey=<> --secretKey=<> --crossAccountRoleArn=<> --externalId=<>
If you build it locally , you can simply run it as standalone command as:
go run main.go --zone=us-east-1 --accessKey=<> --secretKey=<> --crossAccountRoleArn=<> --externalId=<>
rds extension
- CMD used to get list of rds instance's :
./awsx-rds --zone=us-east-1 --accessKey=<> --secretKey=<> --crossAccountRoleArn=<> --externalId=<>
- CMD used to get Config data (metadata) of AWS RDS instances :
./awsx-rds --zone=us-east-1 --accessKey=<#6f> --secretKey=<> --crossAccountRoleArn=<> --externalId=<> getConfigData --dbInstanceIdentifier=<>