Skip to content

Latest commit

 

History

History
93 lines (61 loc) · 3 KB

README.md

File metadata and controls

93 lines (61 loc) · 3 KB
Gitmoji

Open edX Instance Using Amazon EC2

Deploy

A Single instance Open edX Server in AWS.

The VM will be deployed in a public subnet of your default VPC.

Getting started

Prerequisites

  1. Register for Ubuntu 20.04 offical image on AWS Marketplace
  2. Install Pulumi
  3. Configure Pulumi for AWS
  4. Configure Pulumi for Python
  5. Create a virtualenv
  6. pip install -r requirements.txt

Deploying and running the program

First, create a stack, using pulumi stack init.

$ pulumi stack init dev

Next, generate an OpenSSH keypair for use with your server - as per the AWS Requirements

$ ssh-keygen -t rsa -f rsa -b 4096 -m PEM

This will output two files, rsa and rsa.pub, in the current directory. Be sure not to commit these files!

We then need to configure our stack so that the public key is used by our EC2 instance, and the private key used for subsequent SCP and SSH steps that will configure our server after it is stood up.

$ cat rsa.pub | pulumi config set publicKey --
$ cat rsa | pulumi config set privateKey --secret --

If your key is protected by a passphrase, add that too:

$ pulumi config set privateKeyPassphrase --secret [yourPassphraseHere]

Notice that we've used --secret for both privateKey and privateKeyPassphrase. This ensures their are stored in encrypted form in the Pulumi secrets system.

Also set your desired AWS region:

$ pulumi config set aws:region eu-west-2

From there, you can run pulumi up and all resources will be provisioned and configured.

The installation script for Open edX can take up to 2 hours. In the meantime you can still connect to your instance.

Connect to your instance

To view the host name and IP address of the instance via pulumi stack output

Current stack outputs (2):
    OUTPUT      VALUE
    public_dns  your-instance-dns-name
    public_ip   your-instance-ip-address

You can use the ssh key to connect to your instance:

$ ssh -i rsa ubuntu@$(pulumi stack output public_ip)

If you are using Windows Subsystem for Linux (WSL) you will need to:

  1. Copy the private into .pem: cp rsa rsa.pem
  2. Change permissions on rsa.pem.

Clean up

To clean up resources, run pulumi destroy and answer the confirmation question at the prompt.