Updated AWS EC2 (markdown)

master
Hunter Long 2018-12-04 03:10:03 -08:00
parent 6e0644ba69
commit f54707057f
1 changed files with 23 additions and 11 deletions

@ -1,4 +1,4 @@
Running Statping on the smallest EC2 server is very quick using the AWS AMI Image. When the AMI image boots it will automatically run the [init.sh](https://github.com/hunterlong/statping/blob/master/servers/init.sh) script to update Docker containers and remove unused containers/images. The server will also re-download the init.sh script to make sure it is up-to-date with the latest updates and bug fixes.
Running Statping on the smallest EC2 server is very quick using the AWS AMI Image. When the AMI image boots it will automatically run the [init.sh](https://github.com/hunterlong/statping/blob/master/dev/init.sh) script to update Docker containers and remove unused containers/images. The server will also re-download the init.sh script to make sure it is up-to-date with the latest updates and bug fixes.
# AMI Image
Choose the correct AMI Image ID based on your AWS region.
@ -7,6 +7,8 @@ Choose the correct AMI Image ID based on your AWS region.
- us-west-1 `ami-6d1ffd0e`
- us-west-2 `ami-7be8a103`
Then set the image with a environment variable: `AMI_IMAGE=ami-7be8a103`
# EC2 Server Features
Running your Statping server on a small EC2 instance is perfect for most users. Below you'll find some commands to get up and running in seconds.
- Super cheap on the t2.nano (~$4.60 monthly)
@ -24,22 +26,28 @@ aws ec2 create-security-group --group-name StatpingPublicHTTP --description "Sta
# will response back a Group ID. Copy ID and use it for --group-id below.
```
```bash
aws ec2 authorize-security-group-ingress --group-id sg-7e8b830f --protocol tcp --port 80 --cidr 0.0.0.0/0
aws ec2 authorize-security-group-ingress --group-id sg-7e8b830f --protocol tcp --port 443 --cidr 0.0.0.0/0
GROUPS=sg-7e8b830f
aws ec2 authorize-security-group-ingress --group-id $GROUPS --protocol tcp --port 80 --cidr 0.0.0.0/0
aws ec2 authorize-security-group-ingress --group-id $GROUPS --protocol tcp --port 443 --cidr 0.0.0.0/0
```
## Create EC2 without SSL
Once your server has started, go to the EC2 Public DNS endpoint. You should be redirected to /setup to continue your installation process! The database information is already inputed for you.
```bash
GROUPS=sg-7e8b830f
KEY=MYKEYHERE
AMI_IMAGE=ami-7be8a103
aws ec2 run-instances \
--image-id ami-7be8a103 \
--image-id $AMI_IMAGE \
--count 1 --instance-type t2.nano \
--key-name MYKEYHERE \
--security-group-ids sg-7e8b830f
--key-name $KEY \
--security-group-ids $GROUPS
```
## Create EC2 with Automatic SSL Certification
This is an awesome way to do things, start a Statping server with an SSL cert that will automatically regenerate when its near expiration time. You'll need to point your domain's A record (IP address) or CNAME (public DNS endpoint) to use this feature.
Start a Statping server with an SSL cert that will automatically regenerate when it's near expiration time. You'll need to point your domain's A record (IP address) or CNAME (public DNS endpoint) to use this feature.
```bash
wget https://raw.githubusercontent.com/hunterlong/statping/master/servers/ec2-ssl.sh
wget https://raw.githubusercontent.com/hunterlong/statping/master/dev/ec2-ssl.sh
```
```bash
@ -49,12 +57,16 @@ LETSENCRYPT_EMAIL="noreply@MYEMAIL.com"
```
Edit ec2-ssl.sh and insert your domain you want to use, then run command below. Use the Security Group ID that you used above for --security-group-ids
```
GROUPS=sg-7e8b830f
AMI_IMAGE=ami-7be8a103
KEY=MYKEYHERE
aws ec2 run-instances \
--user-data file://ec2-ssl.sh \
--image-id ami-7be8a103 \
--image-id $AMI_IMAGE \
--count 1 --instance-type t2.nano \
--key-name MYKEYHERE \
--security-group-ids sg-7e8b830f
--key-name $KEY \
--security-group-ids $GROUPS
```
### EC2 Server Specs