Parse Server Migration on AWS

Parse Server Migration on AWS: With the upcoming Parse shutdown on January 28, 2017, you’re probably already thinking about what to do next. Luckily, Parse developers left its Parse Server as open source and have made it possible to migrate it to another platform. In this post, we’ll guide you through a seamless and cost effective Parse database migration on AWS and MongoDB.

About Parse

Parse was founded in 2011 by Tikhon Bernstam, Ilya Sukhar, James Yu, and Kevin Lacker. Parse is a SaaS (Software as a Service) backend provider for mobile and web applications. They offer services that help mobile developers store data in the cloud, manage identity log-ins, handle push notifications, and run custom code in the cloud. Parse was acquired by Facebook in the spring of 2013.
Parse allows you to easily build applications without building your own backend. It comes with out-of-the-box features such as:

  • Data storage in a document-oriented database
  • Files storage
  • User password and third-party authentication (for example with Facebook)
  • Push notifications
  • Apple In-App Purchases validation

Parse Database Migration Overview

The Parse Server migration on AWS process follows these 3 steps:

  1. Database migration
  2. Files migration
  3. Parse Server migration/deployment

Requirements:

  • AWS Account
  • MongoDB Cloud Manager Account
Migrate Parse DB to Self-Hosted MongoDB
Migrate Parse DB to Self-Hosted MongoDB

Database Migration on AWS

Parse Server uses MongoDB, so you will need to set-up your own MongoDB database to perform the migration. While there are several methods available, Parse developers recommend using mLAb for migration.
mLab is a fully managed cloud database service featuring automated provisioning and scaling of MongoDB databases, backup and recovery, 24/7 monitoring and alerting, web-based management tools, and expert support. mLab’s Database-as-a-Service platform powers hundreds of thousands of databases across AWS, Azure, and Google. It allows developers to focus their attention on product development instead of operations.
Nevertheless, if we observe mLab’s pricing, it may not be the most cost effective option. Instead, we’ll use MongoDB Cloud Manager to create three replica sets on our AWS account.
MongoDB Cloud Manager is a service for managing, monitoring, and backing up a MongoDB infrastructure. In addition, Cloud Manager allows Administrators to maintain a server pool to facilitate the deployment of MongoDB.
To start the process of database migration, we need to create a Deploy MongoDB three replica set on AWS using MongoDB Cloud Manager. For migrating Parse DB, official documentation advises us to keep in mind that the size of our MongoDB database must be at least three times the size of our current amount of data stored using Parse.
Replica set refers to a group of MongoDB instances that hold the same data. The purpose of replication is to ensure high availability in case one of the servers goes down. This reference deployment supports one or three replica sets. In the case of three replica sets, the reference deployment launches three servers in three different Availability Zones (if the region supports it). In production clusters, Amazon Web Services recommends using three replica sets (Primary, Secondary0, Secondary1). All clients typically interact with the primary node for read and write operations.

MongoDB Cluster on AWS with Three Replica Sets
MongoDB Cluster on AWS with Three Replica Sets

 

Low Data Transfer Rate High Data Transfer Rate
Parse Data Storage < 4GB m4.large, 40GB m4.xlarge, 80GB
Parse Data Storage > 4GB m4.large, 80GB m4.xlarge, 80GB

 Instance size recommendation

Deploy MongoDB replica set on AWS using MongoDB Cloud Manager

  1. Login to your MongoDB Cloud Manager account
  2. Click “Build New” and chose Amazon Web Services under New Cloud Servers
  3. Chose “us-east-1” region and provide Access Key Id and Secret Access Key for your AWS account
  4. Click “Create Replica Set”, enter replica set name and click Continue
  5. Use Cloud Manager to back up your data, click Yes
  6. Configure your EC2 Instances (see Instance size recommendation table)
  7. Click “Provision Servers” and wait. Once three server automation agents are visible, click “Continue”
  8. Click “Advanced Setup” in the top right. Then click the wrench icon on the top right of the Replica Set topology view to open the Replica Set editor
  9. Modify the version to 3.0.x latest and click “Apply”
  10. Click “Review & Deploy”, then “Confirm & Deploy”
  11. Expand “Advanced Options”, and click the “Add Option” button (Add the option Startup Option: “failIndexKeyTooLong”; Value: false)
  12. Click “Apply”, and again “Review and Deploy” your changes
  13. Click “Add user” and create a new user with the specs below

database: “admin”
username: “<yourusername>”
roles: root@admin

Connect MongoDB Cloud manager with your AWS account
Connect MongoDB Cloud Manager with your AWS account

Now you can test the connection to your MongoDB Replica Set.
MongoDB_ReplicaSet_URI:

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

Once we’re connected to our MongoDB three replica set, we need to create a user that will be utilized for migrating our data from Parse to our MongoDB. We can create the user with the following commands, and it’s mandatory for the user to have these exact roles enabled.

use database_name
db.createUser({ user: "parse", pwd: "password", roles: [ "readWrite", "dbAdmin" ] })

After we’ve created the MongoDB three replica set and our user, we need to export our data from Parse into the MongoDB replica set.

Export Data from Parse into MongoDB

Parse App Management
Parse App Management

 

  1. Go to the new Parse dashboard > “App Settings” and click on “Migrate to external database”
  2. Provide the MongoDB_ReplicaSet_URI
  3. Click the “Begin the migration” button
  4. Ensure that the data is written to your MongoDB Replica Set.
  5. Once you’re satisfied with the database migration on AWS, you can finalize the transfer in the migration UI
Database migration finished
Database migration finished

NOTE: It is important to note that the Finalize action is irreversible. You will not be able to switch back to the Parse managed database. You will be responsible for any backups and recovery of your data. Only proceed once you have backed up your new database.

Files Migration

Parse Objects can have File fields that allow you to store files such as those for images or pdf documents. Parse keeps files in its own AWS S3 Bucket and Mongo database only stores references (URLs) to them. Migrating a database as described above copies only database data and file references, but not the files themselves. You must move the files to your storage before January 28, 2017 or they will be deleted.
We recommend storing files on S3 bucket in your AWS account.

Parse Server Migration on AWS/Deployment

If we consider that Elastic Beanstalk supports Node.js and enables automatic infrastructure scaling, we see it as the best choice for Parse Server migration on AWS.

To launch Parse Server on AWS Elastic Beanstalk click the following link. This will launch the AWS Elastic Beanstalk deployment flow.

AWS Elastic Beanstalk deployment flow
AWS Elastic Beanstalk deployment flow

Once we’ve created the Elastic Beanstalk environment, we need to deploy our application on it. We’ll do it using eb deploy from the root folder of our application. In order to use the eb deploy command, we need to have ebs cli (elastic beanstalk command line interface) installed on our local machine.
When ebs cli install is complete, in case we didn’t have it installed, we’ll enter the eb init command and select the us-east -1 (N Virginia) region. After that, we will proceed by choosing the name of our application (the name we used for creating the Elastic Beanstalk environment).
Before deploying, we need to create the .ebextesnions folder. In this folder, we’ll create a 01app.config file that will pass the following configuration commands to our Elastic Beanstalk:

option_settings:
 aws:elasticbeanstalk:application:environment:
    PARSE_MOUNT: "/parse"
    APP_ID: <your app id>
    MASTER_KEY: <your master key>
    DATABASE_URI: <your database uri>
    NODE_ENV: "production"
    SERVER_URL: <your server url>
  aws:elasticbeanstalk:container:nodejs:
    NodeCommand: "npm start"
Elastic Beanstalk Container Options
Elastic Beanstalk Container Options
Elastic Beanstalk Environment Properties
Elastic Beanstalk Environment Properties

By using the 01app.config file, we passed the necessary ENVIRONMENT variables and “npm  start” command to our Elastic Beanstalk environment.
If you want to learn more about configuration files for Elastic Beanstalk, please check the following link.
Another way to deploy our application is to take its source code, pack it into a .zip file, and upload it to the S3 on our Elastic Beanstalk environment.

Parse Dashboard

After Parse Server became open source, it was unclear how to manage an application running on your own system. This is where we introduce Parse Dashboard. It will help you manage the apps that you have already moved to Parse Server, your apps that are still on Parse.com, and the apps that are still in development and running on Parse Server on your development machine. You can even manage them all from the same dashboard.
Once the Parse Server migration on AWS is complete, it’s necessary to deploy Parse Dashboard on Elastic Beanstalk.
To deploy Parse Dashboard on Elastic Beanstalk, we need to download Parse Dashboard application code, then initialize the Elastic Beanstalk environment. Then, we will execute the deploy using the eb deploy command. We’ll use the config file inside the .ebexstensions to start the Parse Dashboard and push the necessary data for communicating with our application.
To securely deploy the dashboard without leaking your app’s master key, you will need to use HTTPS and Basic Authentication. You can configure your dashboard for Basic Authentication by adding usernames and passwords to your parse-dashboard-config.json configuration file.

option_settings:
  aws:elasticbeanstalk:application:environment:
    APP_ID: <your app id>
    MASTER_KEY: <your master key>
    APP_NAME: "<your app name>"
    NODE_ENV: "production"
    SERVER_URL: <www.yourparseapp.com>/parse
  aws:elasticbeanstalk:container:nodejs:
    NodeCommand: "npm start dashboard"
Parse Dashboard
Parse Dashboard

Wrap Up

The Parse shut down doesn’t mean the extinction of the apps that were using it. Even Facebook said that they wouldn’t necessarily call it a “shut down”. Instead, they see it as a way of entrusting Parse to the community in the form of an open source Parse Server.
Surely, some time will pass before we see the community fully included in the development of Parse Server, especially when it comes to developing certain functionalities that will be missed after its shut down.
Nevertheless, it’s quite certain that we will still be using Parse Server even after its official “shut down” and in the years to come.
Naturally, the shut down isn’t painless and will create some short term issues due to necessary migrations. However, the availability of the Parse Server code to the community can benefit us in the future.

So, goodbye Parse, and Hello Parse Server.

 

Avatar

Written by

Dzenan Dzevlan

Certified AWS Solutions Architect Associate and SysOps, highly experienced at producing multi-tier, high-availability infrastructure architectures in an enterprise & AWS cloud environment adhering to DR, Business Continuity, availability and security best practice. Founder and co-organizer of the first AWS User Group in Bosnia and Herzegovina .

Related Posts

Alisha Reyes
Alisha Reyes
— August 22, 2019

How to Unlock Complimentary Access to Cloud Academy

Are you looking to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Cloud Security, Python, Java, or another technical skill? Then you'll want to mark your calendars for August 23, 2019. Starting Friday at 12:00 a.m. PDT (3:00 a.m. EDT), Cloud Academy is offering c...

Read more
  • AWS
  • Azure
  • cloud academy content
  • complimentary access
  • GCP
  • on the house
Avatar
Michael Sheehy
— August 19, 2019

What Exactly Is a Cloud Architect and How Do You Become One?

One of the buzzwords surrounding the cloud that I'm sure you've heard is "Cloud Architect." In this article, I will outline my understanding of what a cloud architect does and I'll analyze the skills and certifications necessary to become one. I will also list some of the types of jobs ...

Read more
  • AWS
  • Cloud Computing
Avatar
Nitheesh Poojary
— August 19, 2019

Boto: Using Python to Automate AWS Services

Boto allows you to write scripts to automate things like starting AWS EC2 instances Boto is a Python package that provides programmatic connectivity to Amazon Web Services (AWS). AWS offers a range of services for dynamically scaling servers including the core compute service, Elastic...

Read more
  • Automated AWS Services
  • AWS
  • Boto
  • Python
Avatar
Andrew Larkin
— August 13, 2019

Content Roadmap: AZ-500, ITIL 4, MS-100, Google Cloud Associate Engineer, and More

Last month, Cloud Academy joined forces with QA, the UK’s largest B2B skills provider, and it put us in an excellent position to solve a massive skills gap problem. As a result of this collaboration, you will see our training library grow with additions from QA’s massive catalog of 500+...

Read more
  • AWS
  • Azure
  • content roadmap
  • Google Cloud Platform
Avatar
Adam Hawkins
— August 9, 2019

DevSecOps: How to Secure DevOps Environments

Security has been a friction point when discussing DevOps. This stems from the assumption that DevOps teams move too fast to handle security concerns. This makes sense if Information Security (InfoSec) is separate from the DevOps value stream, or if development velocity exceeds the band...

Read more
  • AWS
  • cloud security
  • DevOps
  • DevSecOps
  • Security
Avatar
Stefano Giacone
— August 8, 2019

Test Your Cloud Knowledge on AWS, Azure, or Google Cloud Platform

Cloud skills are in demand | In today's digital era, employers are constantly seeking skilled professionals with working knowledge of AWS, Azure, and Google Cloud Platform. According to the 2019 Trends in Cloud Transformation report by 451 Research: Business and IT transformations re...

Read more
  • AWS
  • Cloud skills
  • Google Cloud
  • Microsoft Azure
Avatar
Andrew Larkin
— August 7, 2019

Disadvantages of Cloud Computing

If you want to deliver digital services of any kind, you’ll need to estimate all types of resources, not the least of which are CPU, memory, storage, and network connectivity. Which resources you choose for your delivery —  cloud-based or local — is up to you. But you’ll definitely want...

Read more
  • AWS
  • Azure
  • Cloud Computing
  • Google Cloud Platform
Joe Nemer
Joe Nemer
— August 6, 2019

Google Cloud vs AWS: A Comparison (or can they be compared?)

The "Google Cloud vs AWS" argument used to be a common discussion among our members, but is this still really a thing? You may already know that there are three major players in the public cloud platforms arena: Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP)...

Read more
  • AWS
  • Google Cloud Platform
  • Kubernetes
Avatar
Stuart Scott
— July 29, 2019

Deployment Orchestration with AWS Elastic Beanstalk

If you're responsible for the development and deployment of web applications within your AWS environment for your organization, then it's likely you've heard of AWS Elastic Beanstalk. If you are new to this service, or simply need to know a bit more about the service and the benefits th...

Read more
  • AWS
  • elastic beanstalk
Avatar
Stuart Scott
— July 26, 2019

How to Use & Install the AWS CLI

What is the AWS CLI? | The AWS Command Line Interface (CLI) is for managing your AWS services from a terminal session on your own client, allowing you to control and configure multiple AWS services and implement a level of automation. If you’ve been using AWS for some time and feel...

Read more
  • AWS
  • AWS CLI
  • Command line interface
Alisha Reyes
Alisha Reyes
— July 22, 2019

Cloud Academy’s Blog Digest: July 2019

July has been a very exciting month for us at Cloud Academy. On July 10, we officially joined forces with QA, the UK’s largest B2B skills provider (read the announcement). Over the coming weeks, you will see additions from QA’s massive catalog of 500+ certification courses and 1500+ ins...

Read more
  • AWS
  • Azure
  • Cloud Academy
  • Cybersecurity
  • DevOps
  • Kubernetes
Avatar
Stuart Scott
— July 18, 2019

AWS Fundamentals: Understanding Compute, Storage, Database, Networking & Security

If you are just starting out on your journey toward mastering AWS cloud computing, then your first stop should be to understand the AWS fundamentals. This will enable you to get a solid foundation to then expand your knowledge across the entire AWS service catalog.   It can be both d...

Read more
  • AWS
  • Compute
  • Database
  • fundamentals
  • networking
  • Security
  • Storage