I started to think about how I can make database service requests more agile and self served. As a Cloud Data platform architect I have access to full resources however, often times I overwhelmed with requests people think I am responsible for , but I am not really, the DBAs are. The point I am making here is, how well I can integrate db services into CI/CD pipelines and/or deployment work flows. During each release, devOps request a database snapshot be taken prior to deployment.
I developed a webApp written using python flask web framework to expose RESTful API calls using AWS python SDK. the flask application use API calls defined as routes
Below is the diagram depicts a simple architectural diagram
The web interface (HTML) or curl command can be used to request for a
- taking database backup
- checking the backup of an existing backup/snapshot
- deleting a manual on demand backup previously taken
API app is written using Python Flask Web Frame work with API endpoints called routes. The tool can be used in two forms
- HTTPS calls via browser. A basic interface for submitting a request through HTML interface.
Examples:
webApp via HTTPS or CURL
#Main Page
#https://10.10.x.x:25443/backup
#create cluster db snapshot
curl -k https://10.10.x.x:25443/backup/create \
--data "endpoint=mydB1-net1.us-east-1.rds.amazonaws.com"; \
echo
#https://10.10.x.x:25443/backup/create
#check cluster db snapshot
curl -k https://10.10.x.x:25443/backup/status \
--data "snapshotname=mydB1-2018-06-24-22-21-57" \
--data "endpoint=mydB1.cluster-ro-net1.us-east-1.rds.amazonaws.com"; \
echo
#https://10.10.x.x:25443/backup/status
#delete cluster db snapshot
curl -k https://10.10.x.x:25443/backup/delete \
--data "snapshotname=mydB1-2018-06-24-22-21-57" \
--data "endpoint=mydB1.cluster-ro-net1.us-east-1.rds.amazonaws.com"; \
echo
#https://10.10.x.x:25443/backup/delete
Scheduling during or pre deployment:
#!/bin/bash#Author: Sudheer Kondla, 06/27/2018 if [ $# -lt 1 ];thenecho "USAGE: bash $0 [require Fully Qualified db endpoint]"exit 1fidbEndPoint=$1 /usr/bin/curl -k https://10.10.x.x:25443/backup/create \--data "endpoint=${dbEndPoint}"; echo |