Ruby on Rails Server Using Amazon EC2
This is a conversion of the AWS CloudFormation Application Framework template for a basic Ruby on Rails server. It creates a single EC2 virtual machine instance and uses a local MySQL database for storage. Sourced from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-appframeworks-us-west-2.html.
Deploying the App
To deploy your Ruby on Rails application, follow the below steps.
Prerequisites
Steps
After cloning this repo, from this working directory, run these commands:
Create a new stack, which is an isolated deployment target for this example:
$ pulumi stack init
Set the required configuration variables for this program:
$ pulumi config set aws:region us-east-1 $ pulumi config set dbUser [your-mysql-user-here] $ pulumi config set dbPassword [your-mysql-password-here] --secret $ pulumi config set dbRootPassword [your-mysql-root-password-here] --secret
Stand up the VM, which will also install and configure Ruby on Rails and MySQL:
$ pulumi up
After several minutes, your VM will be ready, and two stack outputs are printed:
$ pulumi stack output Current stack outputs (2): OUTPUT VALUE vmIP 53.40.227.82 websiteURL http://ec2-53-40-227-82.us-west-2.compute.amazonaws.com/notes
Visit your new website by entering the websiteURL into your browser, or running:
$ curl $(pulumi stack output websiteURL)
From there, feel free to experiment. Simply making edits and running
pulumi up
will incrementally update your VM.Afterwards, destroy your stack and remove it:
$ pulumi destroy --yes $ pulumi stack rm --yes