Skip to content

Latest commit

 

History

History
executable file
·
93 lines (57 loc) · 2 KB

aws-ec2-run-instances-for-cdn.md

File metadata and controls

executable file
·
93 lines (57 loc) · 2 KB

AWS EC2 run-instances for content delivery network

This is our typical settings to launch a new AWS EC2 server, suitable for our typical content delivery network server.

Adjust these instructions as you like for your purposes.

AMI image id:

  • ami-05aa248bfb1c99d0f: Ubuntu 18.04 server, most recent version, by Canonical.

Instance type:

  • r4.xlarge: high memory, needed for the CDN to provide many open connections.

VPC:

  • To get a list of VPCs: aws ec2 describe-vpcs

  • We choose the subnet that matches the CDN purpose.

Subnet:

  • To get a list of subnets: aws ec2 describe-subnets

  • We choose the subnet that matches the CDN purpose.

Key name:

Security group id:

Volume type:

  • gp2: General Purpose SSD (we use this for the operating system storage)

  • io1: Provisioned IOPS SSD

  • st1: Throughput Optimized HDD

  • sc1: Cold HDD

Device mappings:

  • /dev/sda1 400 gig SSD

Other settings:

  • monitoring enabled

  • ebs optimized

  • disable termination

Command:

aws ec2 run-instances \
--dry-run \
--profile my-profile-name \
--image-id ami-05aa248bfb1c99d0f \
--subnet-id subnet-??????? \
--count 1 \
--instance-type r4.xlarge \
--monitoring "Enabled=true" \
--ebs-optimized \
--disable-api-termination \
--key-name ????????? \
--security-group-ids ????????? \
--block-device-mappings '{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":400,"VolumeType":"gp2","DeleteOnTermination":true}]'

Add a tag for the name:

aws ec2 create-tags \
--dry-run \
--profile my-profile-name \
--resources i-xxxxxxxx \
--tags "Key=Name,Value=CDN"