Set Up EC2

Deploying and running the Prefect app on AWS EC2. But the principles should be universal.

Setting up your instance

Step 1. Find EC2 on your AWS console

Step 2. Select an Ubuntu instance

Step 3. Select a general purpose t2.micro

Step 4. Whitelist your IP address.

Step 5. Download a new or existing pair of ssh keys.

Connecting to Your Instance

Optional Step. Move your new ssh key into your project directory

This step isn't necessary but I did it so I could stay organized and make the upcoming commands easier. I used my GUI window explorer to move my keys from my downloads folder to my project repo. If you don't know what your are looking for, the file should be called whatever-you-named-your-keys-in -step-5.pem

Step 7. Find your IPv4 address

Find your instance from the EC2 dashboard.

Go to your instance dashboard by clicking the link on Running Instances or Instances.

Find your IPv4 Address

Your IPv4 address should be of the form xxx.xxx.xxx.xxx or 127.0.0.0. Max of 3 digits between each each dot, sometimes its just 1 or two digits.

Step 8. Use ssh to connect to your instance

Now you have your IPv4 address and know where your ssh_keys are saved. Run the command below.

sudo ssh -i path/to/ssh/key.pem ubuntu@xxx.xxx.xxx.xxx

Step 9. Set up your project

this tutorial assumes you have used github or a similar product for version control. So you can simply run git clone your_repo.git to create your new folder.

Step 10. Set up your environment

If you have used a pipenv environment in development of your project, you can just follow the guide in the chapter Starting with Pipenv.

Step 11. Remember to add your .env variables

If your project uses environment variables remember to transfer them to your new environment. I just copy and pasted them from a local directory into the ec2 terminal.

Last updated