Accessing Heroku Postgres Instance from EC2 - heroku

I have an application that we are currently running on a number of co-located servers and I'm interested in moving everything to the cloud.
I have a legacy application running Postgres and its replacement application using MySql as its data store. I'm interested in moving to EC2 and looking to do this as pain free as possible. I was planning on using Amazon RDS for the MySql data store but am looking for options for the Postgres install.
I know that Heroku is built on top of EC2 and has Postres support and was wondering
Has anyone had any experience accessing a Heroku Postgres database from an application running in EC2. Comments on Performance, Reliability ease of Administration
The other alternative is to install Postgres on EC2 with EBS volumes but I've heard mixed reviews on performance, reliablitity and ease of administration.
Thanks in advance, any experience and suggestions would be greatly appreciated.

I've done this with several colocated boxes on the east coast. Heroku actually has a completely independent service: Heroku Postgres, which is built for this specific use case. The databases you create are all independent (not related to any Heroku apps).

Related

mySql Server Placement on AWS EC2 or RDS

We are currently setting up AWS hosting for our Web Application.
This Laravel Web Application will have a Schema per company that registers, meaning it will have a large sized mySql server.
I have gone through the motions of setting up a VPC with EC2 instances and and RDS for this mySql server.
However we are currently looking at using Laravel Forge as a tool to host.
What Forge does differently is that it includes the mySql Server on the EC2 instance not on an RDS.
The question I have come to ask here is, what are the implications if any of having the mySql server on the EC2 instance rather then an RDS.
Would there be performance issues?
Is it better practice to have an RDS?
Or is Forges out the box way of packaging this all together on an EC2 server fine?
By running this on an EC2 instance you will taking more of the responsibility of managing the database, not just installation but also patching, backups, recovery. Harder to maintain functionality such as replication and HA will also be on you to implement and monitor.
By running on RDS AWS is going to take the heavy lifting of this and implement a best practice version of MySQL which offers the flexibility of allowing you to run a MySQL stack in the cloud without having to really think about the implementation details under the hood other than deciding do you want it to be HA and how many replicas do you want.
In saying this by using RDS you're also giving up the ability to run it however you want, you are limited to the versions of the database that RDS supports (although this is now quite soon after release). In addition not all plugins or extensions will be active so check this functionality before deciding.

Options other than master-master replication?

I want to migrate an EC2 instance of MySQL 5.5 to, at least, MySQL 5.6 (ideally to MariaDB 10,x) on RDS. Naturally, I'm going to use replication to do that. Part of the procedure requires a master-master setup between EC2-Mysql and RDS-Mysql and I don't think that's doable (been trying for awhile).
The reason for the master-master setup is this: Once the application is pointing to the RDS endpoint, I'd like any changes made to the RDS database to be replicated to the EC2 database in case we decide to rollback to using the EC2 instance. The MM setup won't be for long; probably overnight at most. And I can't think of a reason to roll back to using the EC2 instance, but I'm overly paranoid when it comes to production data.
Is it possible to have a master-master setup with EC2 and RDS? Some sites say "no", others, "yes". I've been trying but keep running into problems (internal timestamp formats, lack of STATEMENT based replication on RDS, etc.).
If I can't do an MM replication, is there another way for me to be able to roll back JIC?
Oh, and I can't use AWS' Database Migration Service since I have a couple thousand databases to migrate (don't ask).

Running multiple environments on one AWS EC2 instance (Elastic Beanstalk)

I am very new to the Amazon AWS services. I was wondering if there is a way to run an instance of EC2 (say, Amazon Linux AMI) and then connect two environments to this instance.
Particularly, I'd like to run a PHP and a Tomcat environment on a single EC2 instance.
The problem is, every time I create a new environment in Elastic Beanstalk, it seems to create a new EC2 instance as well. Am I missing something here?
I'd appreciate any hint on this.
AWS Elastic Beanstalk is designed for deploying your running apps in a way that is designed for scalability from the ground-up. Because of this, Elastic Beanstalk will launch one or more EC2 instances, connect them to an Elastic Load Balancer instance, configure CloudWatch monitoring and Auto Scaling triggers.
Also, because of its fundamental design for scalability, Elastic Beanstalk is designed around a one-app-per-environment model (whereby "environment", I mean one of these EC2 + ELB + CloudWatch + AutoScaling clusters).
Since running two separate web servers with two separate apps (PHP & Java) is not a fundamentally scalable design, it's not a use-case that Elastic Beanstalk is optimized for.
You are free to spin-up a standalone EC2 instance and install whatever you'd like on it, but you're right — git aws.push support has not been made available for standalone EC2 instances. If the git support is important to you, you'll need to weigh the pros and cons of each approach.
I would also like to be able to do this, basically from a cost perspective for demos etc.
For example, a single instance with one PHP app and one Java app. Or, a single instance with two Java apps.
However, from what I have read so far in the Elastic Beanstalk developer guide, I have not found anything explicitly stating that multiple applications per environment is supported (or even, multiple environments per EC2 instance - if that even makes sense).
It makes me wonder if this is a feature that is often requested and planned for the future, or alternatively if the single-app-per-environment model is 'by design' for some reason.

Heroku: performance of Mongodb vs. Postgres

I'm creating a python pyramid app on Heroku, and I was wondering if anyone can give me some insight on how the performance will compare between MongoDB (via Heroku's MongoHQ add on -> https://addons.heroku.com/mongohq) and the Heroku's built-in Postgres? It seems to me that MongoDB will be at a huge disadvantage here because its hosted on EC2 rather than locally, so any call to it will have to be on Amazon's remote servers.
But perhaps I'm wrong here. Can someone tell me whether my analysis is off or not?
Heroku is entirely hosted on Amazon EC2.
MongoDB will probably be faster than Postgres if you're just doing key/value stuff (like a typical blog), but Postgres will let you do more complex queries and has better reliability.

Should I use a regular server instead of AWS?

Reading about and using the Amazon Web Services, I'm not really able to grasp how to use it correctly. Sorry about the long question:
I have a EC2 instance which mostly does the work of a web server (apache for file sharing and Tomcat with Play Framework for the web app). As it's a web server, the instance is running 24/7.
It just came to my attention that the data on the EC2 instance is non persistent. This means I lose my database and files if it's stopped. But I guess it also means my server settings and installed applications are lost as they are just files in the same way as the other data.
This means that I will either have to rewrite the whole app to use amazon CloudDB or write some code which stores the db on S3 and make my own AMI with the correct applications installed and configured. Or can this be quick-fixed by using EBS somehow?
My question is 1. is my understanding of aws is correct? and 2. is it's worth it? It could be a possibility to just set up a regular dedicated server where everything is persistent, as you would expect. Would love to have the scaleability of aws though..
If you use an EBS volume with your EC2 instance, you can mount/dismount them to have persistent storage. You can also use Amazon RDS to handle your database too which is handy (but can be slightly on the pricier side.)
So a way to think of it is:
Your EC2 instance: Get the OS set up exactly like you'd like it along with your web application - basically, get your static stuff all in place.
EBS volume: That can be mounted and can be used for things like user uploads.
RDS instance: This is a dedicated database server with no hassles. It's nice - I use a MySQL RDS and it automatically makes two daily backups, and is scalable like EC2 instances.
Amazon Web Service is a better approach at hosting your applications Jon. You have a basic understand of AWS but you need to know that you can also launch an instance that is persistent. Just launch an instance of a persistence AMI. Also you can install you database,webs server on the instance like a regular server. There is probably just minimal differences from running an Ec2 instance and a dedicated server. If you have any other questions you can contact me.

Resources