Code Blog

Displaying 1-1 of 1 result.
2016/03/30 VPN,Hosting

I was doing a bit of research for "cloud computing" hosting costs for running Shadowsocks. Amazon Web Services (AWS) is a good option as it's free for the first 12 months when signing up.

For running Shadowsocks the most suitable choice is the small, general cloud computing service "t2.micro" that is free for 12 months (with max 1 instance running). The general cloud computing service is called Amazon Elastic Compute Cloud, normally written Amazon EC2.

Regarding hosting costs I was a bit surprised to see AWS charges different rates for different regions (See https://aws.amazon.com/ec2/pricing/). I have selected Japan for hosting, but AWS also has servers in Seoul, Singapore, US, Europe etc. The hosting costs is actually quite a lot higher in Asia compared to US/Europe.

On-demand t2.micro linux/unix costs (2016-03-30)

Region Cost (USD) / hour Cost (USD) / month (750 h)
US West (Oregon) 0.013 9.75
US West (Northern California) 0.017 12.75
EU (Frankfurt) 0.015 11.25
Asia Pacific (Tokyo) 0.02 15
Asia Pacific (Seoul) 0.02 15
Asia Pacific (Singapore) 0.02 15

Better prices can be had if buying 24/7 hosting contracts over longer periods. AWS writes: "Reserved Instances provide you with a significant discount (up to 75%) compared to On-Demand Instance pricing."

1-year contract for t2.micro linux/unix at Asia Pacific (Tokyo) (2016-03-30)

Payments Upfront Monthly Effective hourly Effective monthly Savings over On-Demand hourly
No upfront 0 10.95 0.015 10.95 25%
Partial upfront 85 3.65 0.0147 10.73 27%
All upfront 126 0 0.0144 10.5 28%

Its basically not a big difference between paying upfront or not (5.4 USD max savings per year) so for me the best choice is monthly with "no upfront". 3-year contracts are also available, with savings up to 53% (effectively 6.86 USD/month for 3 years upfront).

Performance

Technical specs for "t2.micro": 1 vCPU, 1 GB ram, "EBS only" instance storage

From AWS:

T2 instances are Burstable Performance Instances that provide a baseline level of CPU performance with the ability to burst above the baseline. The baseline performance and ability to burst are governed by CPU Credits.

For example, a t2.small instance receives credits continuously at a rate of 12 CPU Credits per hour. This capability provides baseline performance equivalent to 20% of a CPU core. If at any moment the instance does not need the credits it receives, it stores them in its CPU Credit balance for up to 24 hours. If and when your t2.small needs to burst to more than 20% of a core, it draws from its CPU Credit balance to handle this surge seamlessly.

Many applications such as web servers, developer environments and small databases don’t need consistently high levels of CPU, but benefit significantly from having full access to very fast CPUs when they need them. T2 instances are engineered specifically for these use cases. If you need consistently high CPU performance for applications such as video encoding, high volume websites or HPC applications, we recommend you use Fixed Performance Instances.

This is a pretty clever setup for this type of services. The t2.micro gets 6 CPU Credits / hour and runs on Intel Xeon family CPU (up to 3.3 GHz). I guess this means the t2.micro baseline performance is 10% of a Xeon 3.3 GHz CPU.

Binding IP addresses

You can have one Elastic IP (EIP) address associated with a running instance at no charge. If you associate additional EIPs with that instance, you will be charged for each additional EIP associated with that instance per hour on a pro rata basis.

So one IP address is for free which should be enough for Shadowsocks. Here I actually made a mistake, I changed the IP for my instance (as it was working poorly) but I never erased the old one! Turns out one has to pay for Ip addresses not attached to running instances too:

$0.005 per Elastic IP address not attached to a running instance per hour (prorated)

From my monthly bill statement. Turns out you can detach an IP and keep it for free for 1 h, after that AWS will charge you each hour. IP binding remapping are also free for 100 IP bindings/month. 

Data transfer

Data Transfer IN To Amazon EC2 From
Internet $0.00 per GB

Data Transfer OUT From Amazon EC2 To Internet
First 1 GB / month $0.000 per GB
Up to 10 TB / month $0.140 per GB

So here one needs to estimate how much data will actually go via Shadowsocks. If there is a lot of data this will actually be a quite big cost, especially as Youtube is blocked so all that traffic need to go through Shadowsocks.

From my monthly bill I can read that the first 15 GB transfer out was not charged (included in monthly global free tier). The 12 month free tier includes: "15 GB of bandwidth out aggregated across all AWS services".

Storage

Amazon Elastic Block Store (Asia Pacific Tokyo) prices:

Amazon EBS General Purpose (SSD) volumes
$0.12 per GB-month of provisioned storage

Amazon EBS Magnetic volumes
$0.080 per GB-month of provisioned storage
$0.080 per 1 million I/O requests 

 As there wont be any data stored for Shadowsocks this isn't an issue.

The 12 month free tier includes: "30 GB of Amazon Elastic Block Storage in any combination of General Purpose (SSD) or Magnetic".