Skip to content

Commit

Permalink
Docs: Add deployment documentation for connecting to EC2 instance
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Sandvik Lee <[email protected]>
  • Loading branch information
SverreNystad and sandviklee committed Dec 31, 2023
1 parent 1f4e996 commit a34f63f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
Binary file added docs/deployment/aws-ec2-key-pairs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/deployment/cli-public-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions docs/deployment/connect_to_EC2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@


# How to create the SSH key pair

## Create the key pair
Go into key pairs in the EC2 dashboard and create a new key pair. Download the .pem file and save it in the root of the project.

![KeyPairs GUI](aws-ec2-key-pairs.png)
Will automatically download a Private key
![create-key-pair GUI](create-key-pair.png)
Connect to the instance through AWS Instance Connect
Now to connect key pairs to the EC2 instance, we need to add the Public key
Write this and get the public key
```bash
ssh-keygen -y -f /path_to_downloaded_key-pair.pem
```
You will get a public key like this:
![public-key GUI](cli-public-key.png)


```bash
sudo nano .ssh/authorized_keys
```
Now we need to add the public key into the EC2 instance, which we got running on the website through the AWS Instance connect terminal

![AWS Instance connect terminal](aws-instance-connect-terminal.png)

Now we need to reboot the EC2 Instance:
![reboot GUI](reboot-ec2.png)

## Connect to the EC2 instance
We now need the private key to connect, so write this in your terminal
```bash
chmod 400 /path_to_downloaded_key-pair.pem
```

You can now connect to the Ubuntu instance, by writing this:
```bash
ssh -i "/path_to_downloaded_key-pair.pem" [email protected]
```
Binary file added docs/deployment/create-key-pair.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/deployment/reboot-ec2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a34f63f

Please sign in to comment.