The RDS interfaces are a way to access the RDS service we create. After the creation and configuration of the RDS service there is a need of accessing the data, uploading data to this database and running some other program which should be able to connect to the database. Such requirements of accessing and manipulating data by end users of the database and not necessarily the AWS account holder which created the database needs these interfaces.
There are three main such interfaces.
GUI Console
This is the simplest of the interfaces where the user can login through a web browser and start using the DB services. The down side of such access is , it needs a human to interact with the RDS services and we cannot run a database program to do some regular tasks like – backup or analysing the DB etc.
Command Line Interface
It is also called CLI access where you can execute DB command through the AWS command prompt screen which should have been installed in the client computer you are using. Below are the steps to install CLI in your local system using which you will access AWS services.
The steps to install AWS CLI are as below.
Step-1
Check for the version of python in your environment.
ubuntu@ubuntu:~$ python -V ubuntu@ubuntu:~$ python3 -V
When we run the above program, we get the following output −
Python 2.7.12 Python 3.5.2
If the version is less than 2.6 or 3.3 , then you need to upgrade the version of python in your system.
Step -2
Check for availability of the python package named pip . It will be needed to install AWS CLI.
Pip -V
When we run the above program, we get the following output −
pip 10.0.1 from /home/ubuntu/.local/lib/python3.5/site-packages/pip (python 3.5)
Step -3
Issue the following command to install the AWS CLI.
pip install awscli –upgrade –user aws --version
When we run the above program, we get the following output −
Aws-cli/1.11.84 Python/3.6.2 Linux/4.4.0
Step-4
Next we configure the aws CLI with credentials. We issue this command and then input the required values one by one.
aws configure
When we run the above program, we get the following output −
AWS Access Key ID [None]: ****PLE AWS Secret Access Key [None]: ********8 Default region name [None]: us-west-2 Default output format [None]: json
With the above configuration in place you are now ready to use CLI for communicating with AWS environments for setting up and using amazon RDS. In the next chapters we will see how we can do that.
AWS API
Amazon Relational Database Service (Amazon RDS) also provides an application programming interface (API). APIs are used when the information is exchanged between the systems rather than a human issuing the commands and receiving the result. For example, if you want to automate the addition of database instances to a RDS service when the number of transactions reach certain threshold , then you use a AWS SDK to write a program which will monitor the number of database transactions and spin-off a RDS instance when the required condition is met.
Below is an example of API code that creates a copy of a DB snapshot. It is a python program which uses AWS sdk named boto3. The client library in boto3 has a method named copy_db_snapshot which is called by the python program to create a copy of the DB snapshot with the required parameters as shown.
import boto3 client = boto3.client('rds') response = client.copy_db_snapshot( SourceDBSnapshotIdentifier='mydbsnapshot', TargetDBSnapshotIdentifier='mydbsnapshot-copy', ) print(response)
When the above program is run we get the response which describes the various properties of the copy event. Here the term string represents the various names of parameters which is defined by the user for their environment. For example VpcID represents the ID of the vpc in which the copy action is happening.
{ 'DBSnapshot': { 'DBSnapshotIdentifier': 'string', 'DBInstanceIdentifier': 'string', 'SnapshotCreateTime': datetime(2015, 1, 1), 'Engine': 'string', 'AllocatedStorage': 123, 'Status': 'string', 'Port': 123, 'AvailabilityZone': 'string', 'VpcId': 'string', 'InstanceCreateTime': datetime(2015, 1, 1), 'MasterUsername': 'string', 'EngineVersion': 'string', 'LicenseModel': 'string', 'SnapshotType': 'string', 'Iops': 123, 'OptionGroupName': 'string', 'PercentProgress': 123, 'SourceRegion': 'string', 'SourceDBSnapshotIdentifier': 'string', 'StorageType': 'string', 'TdeCredentialArn': 'string', 'Encrypted': True|False, 'KmsKeyId': 'string', 'DBSnapshotArn': 'string', 'Timezone': 'string', 'IAMDatabaseAuthenticationEnabled': True|False, 'ProcessorFeatures': [ { 'Name': 'string', 'Value': 'string' }, ] } }
I truly appreciate this blog post.Thanks Again. Want more.