Here's a quick demo of a Ruby gem that I'm in the process of designing, well at least its internal DSL, wrapping around the excellent
aws-sdk gem by AWS.
I wanted to take a dependency based approach rather than resorting to Cloud Formation, which ultimately is a visual 'wrapper' around the AWS APIs — this could easily be achieved in other languages such as Python or even with a bunch of bash scripts.
However, as a Rubyist, I wanted to take the 'gem' approach, as this would allow me to integrate this into other apps, i.e. I could create an inertialbox internal dashboard type app, or even route calls through to an iOS app — potentially far fetched considering the amount of polish and time it would take to go that far, but at least, this serves as the initial ground work.
I only posted the YouTube video in the morning and since then, I've moved a lot around such as moving the launcher to
AwsMatter::Launcher, making it a global launcher and making it the place where I interconnect services. Here's my latest progress, which ties up provisioning ec2 instances with a primary RDS PostgreSQL backend.
My call to
AwsMatter::Ec2.new returns an instance from which I can easily obtain IDs of all the instances launched, and as such pass this info over to the RDS plan. The trick is that a security group is created for each EC2 instance with ingress rules to the PostgreSQL DB.
Since this is via the private IPs within the default AWS VPC, it's all nice and secure, thanks to AWS deploying their RDS instances behind SSL.
# => AwsMatter::Launcher.new.provision Tagging instances... Waiting for instances to be available... Waiting for instances to have a public DNS entry... ###### Launch Summary ###### ---- EC2 Instance ID: i-04534e238bf50e05e EC2 Region: us-east-1 EC2 Availability Zone: us-east-1a Public DNS: ec2-52-87-200-225.compute-1.amazonaws.com Public IP: 22.214.171.124 Private IP: 172.31.25.214 VPC ID: vpc-c4e6f4a0 Subnet ID: subnet-b39c0beb EBS Optimized?: false ###### Done. ###### Creating 'dummy-client-rds-ingress-from-i-04534e238bf50e05e' security group... Waiting for RDS instances to be available... ###### RDS Launch Summary ###### Instance Identifier: dummy-client-rds-us-east-1-production1 Availability Zone: us-east-1a Endpoint: dummy-client-rds-us-east-1-production1.c6lf7jfinllb.us-east-1.rds.amazonaws.com:5432 Port: 5432 Status: available DB Name: dummy_client_rds_production1 DB User: dummy_client_dbuser Instance Type: db.t2.micro Allocated Storage: 5 GB