This tool provides an automated way to do aurora automatic performance testing, including RDS Aurora clusters and EC2 instances. It supports various actions like creating, deleting, and modifying resources, as well as initializing environments for performance testing.
- RDS Management:
- Create, delete, and modify Aurora clusters and instances.
- Manage custom parameter groups.
- EC2 Management:
- Create and delete EC2 instances for performance testing.
- Initialize performance testing environments.
- Performance Testing:
- Prepare data and run Sysbench OLTP tests.
-
AWS CLI Configuration:
- Set up your AWS credentials and default region using the AWS CLI:
aws configure
- How to configure the aws config, refer to: https://pingcap.awsapps.com/start/#
- Set up your AWS credentials and default region using the AWS CLI:
-
Environment Variables:
- Set the
MASTER_PASSWORD
environment variable for the RDS master user password:export MASTER_PASSWORD="your_master_password"
- Set the
-
IAM Permissions:
- Ensure the IAM user or role has sufficient permissions to manage RDS and EC2 resources.
-
Dependencies:
- Install the required Go modules:
go mod tidy
- Install the required Go modules:
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Build the project:
make
Argument | Short | Description |
---|---|---|
--action |
-a |
Action to perform: create-rds , delete-rds , modify-params , create-client , delete-client , init-perftest-env , prepare-data , perftest-run |
--cluster-id |
-c |
Aurora cluster identifier (required for most actions). |
--instance-id |
-i |
Aurora instance identifier (required for creating/deleting instances). |
--param-group-name |
-p |
Parameter group name (default: my-custom-aurora-mysql80 ). |
--instance-class |
-d |
Aurora instance class (default: db.r6g.4xlarge ). |
--ec2-instance-type |
-t |
EC2 instance type (default: m5.2xlarge ). |
--ec2-image-id |
-m |
EC2 image ID (default: ami-0afb6e8e0625142bc ). |
--ec2-instance-id |
-e |
EC2 instance ID (required for deleting instances or initializing performance environments). |
--ec2-subnet-id |
-s |
EC2 subnet ID. |
--ec2-security-group-id |
-g |
EC2 security group ID. |
--ec2-key-name |
-k |
EC2 key pair name (default: pub-st-rsa ). |
--perf-type |
-o |
Sysbench performance test type: oltp_read_only , oltp_read_write , or oltp_write_only . |
--restore |
-s |
Restore data from S3 instead of preparing data with Sysbench, create a new cluster and restore data from mysql-snapshot |
--role-arn |
-r |
aws login account roleARN (default: arn:aws:iam::986330900858:role/full-manager-service-role ) |
--role-session |
-n |
aws login role session name (default: full-manager-service-role ) |
bin/aurora-vs-TiDB --action=create-rds --cluster-id=Aurora-v3060-perftest --instance-id=Aurora-v3060-perftest-instance --param-group-name=my-custom-aurora-mysql80
bin/aurora-vs-TiDB --action=create-rds --cluster-id=Aurora-v3060-perftest --instance-id=Aurora-v3060-perftest-instance --param-group-name=my-custom-aurora-mysql80
bin/aurora-vs-TiDB --action=modify-params --cluster-id=Aurora-v3060-perftest --param-group-name=my-custom-aurora-mysql80
bin/aurora-vs-TiDB --action=delete-rds --cluster-id=Aurora-v3060-perftest --instance-id=Aurora-v3060-perftest-instance --param-group-name=my-custom-aurora-mysql80
bin/aurora-vs-TiDB --action=create-client-ec2 --ec2-instance-type=m5.2xlarge
bin/aurora-vs-TiDB--action init-perftest-env --ec2-instance-id i-1234567890abcdef0
bin/aurora-vs-TiDB --action prepare-data --ec2-instance-id i-1234567890abcdef0 --cluster-id Aurora-v3060-perftest
bin/aurora-vs-TiDB --action perftest-run --ec2-instance-id i-1234567890abcdef0 --cluster-id Aurora-v3060-perftest --perf-type oltp_read_write
- Main Functionality:
createResources
: Creates Aurora clusters and instances.deleteResources
: Deletes Aurora clusters and instances.modifyClusterParameters
: Modifies Aurora parameter groups.createClientEC2
: Creates EC2 instances for performance testing.
- Utility Functions:
getAuroraClusterVPC
: Retrieves the VPC ID of an Aurora cluster.createSecurityGroup
: Creates a security group for an EC2 instance.
-
Assume Role ARN Privilege and Configuration
- The role that executes
assume-role
needs permissions to performassume-role
,RDS
,EC2
, and other resource operations. For instructions on how to add role permissions, please refer to the AWS Official Documentation.
- The role that executes
-
Restore RDS Snapshot Role ARN Privilege and Configuration
- The role that executes
restore
can be separate from theassume-role
role or the same role. Ensure that the role has permissions forS3
andRDS
operations.
- The role that executes
-
AWS Environment Preparation
- Configure the trust policies for the above two roles. For instructions on how to configure trust policies, please refer to the AWS Official Documentation.
- When running for the first time, please configure the AWS
Access Key ID
,Secret Access Key
, andToken
(these can be set through environment variables, AWS configuration files, etc.).
-
Automatically Refresh Temporary Credential Token
- The
assume-role
operation will run automatically when the program starts and will refresh the temporary token every 10 minutes. The program will automatically refresh the token periodically, so you don't need to worry about token expiration.
- The
-
Performance Test One-Click Script
- You can run the one-click test script
aurora_perfrun.sh
in the project, or you can run individual steps such as resource creation, deletion,assume-role
, running tests, and data preparation. If you choose to run the one-click script, ensure that the permissions and policies described in steps 1-4 are correctly configured.
- You can run the one-click test script
If you encounter any issues during execution, please contact the author for assistance.
- I included hyperlinks to the relevant sections of the AWS official documentation to make it easier for users to find more information.
- If you need further adjustments or additional details, please let me know and I will help refine the content!
This project is licensed under the MIT License.