forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change retains the cfn-init-style JSON input for initializing an EC2 instance, but lowers it to cloud-init rather than bash. This is incomplete, but is sufficient for us to stand up a Ruby on Rails server!
- Loading branch information
Showing
7 changed files
with
146 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# AWS Web Server example in JavaScript | ||
|
||
Deploy an EC2 instance using `@pulumi/aws`. This example shows how to use multiple infrastructure resources in one program. For a detailed walkthrough, see the tutorial [Infrastructure on AWS](https://pulumi.io/quickstart/aws-ec2.html). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,67 @@ | ||
# AWS EC2 Ruby on Rails | ||
|
||
This is a conversion of the AWS CloudFormation Application Framework template for a basic Ruby on Rails server. | ||
It creates a single EC2 instance and uses a local MySQL database for storage. | ||
See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-appframeworks-us-west-2.html. | ||
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 | ||
|
||
1. [Install Pulumi](https://pulumi.io/install) | ||
2. [Configure AWS Credentials](https://pulumi.io/install/aws.html) | ||
|
||
### Steps | ||
|
||
After cloning this repo, from this working directory, run these commands: | ||
|
||
1. Create a new stack, which is an isolated deployment target for this example: | ||
|
||
```bash | ||
$ pulumi stack init | ||
``` | ||
|
||
2. Set the required configuration variables for this program: | ||
|
||
```bash | ||
$ 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 | ||
|
||
# Optionally, if you have an AWS KMS key to use for SSH access: | ||
$ pulumi config set keyName [your-aws-kms-key-name-here] | ||
``` | ||
|
||
3. Stand up the VM, which will also install and configure Ruby on Rails and MySQL: | ||
|
||
```bash | ||
$ pulumi up | ||
``` | ||
|
||
4. After a couple minutes, your VM will be ready, and two stack outputs are printed: | ||
|
||
```bash | ||
$ pulumi stack output | ||
Current stack outputs (2): | ||
OUTPUT VALUE | ||
vmIP 53.40.227.82 | ||
websiteURL http:https://ec2-53-40-227-82.us-west-2.compute.amazonaws.com/notes | ||
``` | ||
|
||
5. Visit your new website by entering the websiteURL into your browser, or running: | ||
|
||
```bash | ||
$ curl curl $(pulumi stack output websiteURL) | ||
``` | ||
|
||
6. From there, feel free to experiment. Simply making edits and running `pulumi up` will incrementally update your VM. | ||
|
||
7. Afterwards, destroy your stack and remove it: | ||
|
||
```bash | ||
$ pulumi destroy --yes | ||
$ pulumi stack rm --yes | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
#!/bin/bash -e | ||
curl -sSL https://get.rvm.io | bash | ||
source /etc/profile.d/rvm.sh | ||
source /etc/profile.d/rvm.sh || true | ||
rvm install 2.3.1 | ||
rvm --default use 2.3.1 | ||
gem install rails |
2 changes: 1 addition & 1 deletion
2
aws-ts-ruby-on-rails/files/start-application → aws-ts-ruby-on-rails/files/start_application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters