I have a GitHub account, and I want to use one of the AWS Support team’s RDS diagnostic scripts with my RDS instance. How do I clone the rds-support-tools Github repository to my EC2 instance running Linux?

Before you begin, make sure that your EC2 instance running Linux has access to any RDS instances you want to use the diagnostic tools on, and that your EC2 instance can connect to the Internet. When you’re ready, you can clone the rds-support-tools GitHub repository to your EC2 instance running Linux by performing the following steps:

1.    Sign in to your GitHub account, access the rds-support-tools GitHub page, and choose Fork in the upper-right corner. This creates a private copy of the repository at https://github.com/<username>/rds-support-tools, where "<username>" is replaced with your GitHub user name.

2.    Install Git on your EC2 instance running Linux by connecting to it through SSH and running the following command:

sudo yum install git-all

3.    Configure Git by running the following commands:

% cd $HOME
% pwd
/home/ec2-user                        # $HOME directory
% ls -la

...
% git config --global user.name "<github username>"
% git config --global user.email "<github email account>"
% git config --global core.editor "<editor preference, e.g. vim>"
% cat .gitconfig
[user]
    name = <username>
    email = <emailaddress>
[core]
    editor = vi

4.    Create a directory for the Git repository by running the following commands:

% pwd
/home/ec2-user
% export GITHUB_ID=<username>
% mkdir $GITHUB_ID
% cd $GITHUB_ID
% pwd
/home/ec2-user/<username>

5.    Clone your private, forked version of the GitHub repository to the directory by using the following commands (make sure to replace <password> with your password):

% echo $GITHUB_ID
     <username>
% git clone https://${GITHUB_ID}:<password>@github.com/${GITHUB_ID}/rds-support-tools.git

6.    Set the the alias origin to the private (GITHUB_ID) remote repository URL using the following commands:

% cd $HOME/$GITHUB_ID/rds-support-tools
% git remote set-url origin https://github.com/${GITHUB_ID}/rds-support-tools.git
% git remote -v
origin https://github.com/<username>/rds-support-tools.git (fetch)
origin https://github.com/<username>/rds-support-tools.git (push)

7.    Set the alias upstream to be the public (awslabs) remote repository URL using the following commands:

% pwd
home/ec2-user/<username>/rds-support-tools
% git remote add upstream https://github.com/awslabs/rds-support-tools.git
% git remote -v
origin https://github.com/<username>/rds-support-tools.git (fetch)
origin https://github.com/<username>/rds-support-tools.git (push)
upstream    https://github.com/awslabs/rds-support-tools.git (fetch)
upstream    https://github.com/awslabs/rds-support-tools.git (push)

After the preceding steps are completed, you can get the latest updates from the public (awslabs) repository at any time by running the following command on your EC2 instance:

% cd $HOME/$GITHUB_ID/rds-support-tools
% pwd
/home/ec2-user/<username>/rds-support-tools
% git pull upstream master
From https://github.com/awslabs/rds-support-tools
 * branch          master    -> FETCH_HEAD
 * [new branch]    master    -> upstream/master
Updating a213555..ab85126
Fast-forward
% git status

RDS, EC2, Linux, GitHub, git, repository


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-12-15