Skip to content

Instantly share code, notes, and snippets.

View markj-s's full-sized avatar

Mark Smoktunowicz markj-s

  • Nottingham, England
View GitHub Profile
@markj-s
markj-s / vpc.md
Last active January 31, 2023 19:06

Setting up a custom VPC in AWS

This guide is based on the AWS console as of January 2023. Over time the appearance of some of the services referenced may change however you should be able to still apply the same principles.

I have used the us-west-2 region for setting up all of my resources.


A “Virtual Private Cloud” or VPC in AWS, is a critical component for hosting cloud applications. We can think of it as being our own private data centre where we manage the network configuration, control access to resources, and build secure connections between our applications and the outside world. It allows us to select the IP address range for IPv4 and IPv6 (both of these are used to identify devices on a network and route data to them), create subnets, and configure route tables, network gateways and security settings. I created this GitHub Gist to go over the steps for adding a custom VPC to your AWS account.

@markj-s
markj-s / instructions.md
Created January 12, 2023 17:13
How to connect to an AWS EC2 without using a key pair

How to connect to an AWS EC2 without using a key pair

If you have created an EC2 and lost your key pair or simply want to connect to it without having to create an SSH connection using Putty, MobaXterm or your laptop's local terminal, then this guide will go over the steps of how to create the necessary role allowing you to use a terminal in your web browser without opening up port 22.

The details in this guide are based on the AWS Console as of January 2023.


Once you have logged into your AWS account, navigate to the IAM service either using the search field or by clicking on the Services menu drop down.

@markj-s
markj-s / instructions.md
Last active January 11, 2023 19:01
Create an AWS Load balancer

Create a load balancer for EC2

I created this guide for my own personal reference. All content related to the AWS console as of January 2023. This guide follows on from my EC2 Autoscaling guide which you may need to read first before completing all of the steps shown below.


  1. Navigate to the EC2 service page and locate "Load balancers" in the left side menu bar.
@markj-s
markj-s / instructions.md
Last active January 11, 2023 19:01
EC2 Autoscaling - Using Launch Templates

EC2 Autoscaling - Using Launch Templates

I created this guide for my own personal reference. All content related to the AWS console as of January 2023.


  1. In EC2, the left side menu, click on "Launch Templates".
  2. Click on "Create launch template".
@markj-s
markj-s / instructions.md
Last active January 11, 2023 19:02
AWS EC2 Autoscaling - Using Launch Configuration

AWS EC2 Autoscaling - Using Launch Configuration

I created this guide for my own personal reference. All content related to the AWS console as of January 2023.


Add a name for your auto scaling group. Click on "Create a launch configuration" (which will open a new window/browser tab).

image

@markj-s
markj-s / instructions.md
Last active January 11, 2023 19:03
Deploy an Apache server on an AWS EC2 using a script and add a static site copying files from AWS S3.

Deploy an Apache server on an AWS EC2 using a script and add a static site copying files from AWS S3.

This file was written for my own personal reference as I continue to learn AWS.

This is another way to host a static site on an EC2 server as opposed to using the static site option on AWS S3.

Add your files (HTML, CSS, JS) to your S3 bucket. Once done you will need to create an instance using the following script inside the EC2 user data section:

#!/bin/bash
@markj-s
markj-s / notes.md
Last active January 23, 2023 09:58
Manually deploy a static website using AWS EC2 and S3

Manually deploy a static website using AWS EC2 and S3

The following assumes you have some static website files (HTML, CSS and JavaScript) and know how to deploy a server adding the necessary http rule to your security group, connect to it and create a S3 bucket. The same result for viewing a static website can be achieved directly in S3 without using an EC2.


Upload your files into a new S3 bucket.

Connect to your EC2 using SSH or ideally with a role using the "AmazonSSMManagedInstanceCore” policy (it is more secure as you are not opening any ports like with SSH which uses port 22).