Blynk server on AWS Linux tutorial video

I made a video on how to deploy a Blynk server on AWS Linux. I hope this helps the community.



thats great - recon you can do one for Google Cloud as well ? Although similar to AWS there are differences that community could find of use.

I also added postgresql capabilities. Here are all the commands. Replace the hostname, email address and password with your info. This works without any errors on AWS AMI Linux (see video).

sudo yum remove -y java-1.7.0-openjdk.x86_64
sudo yum -y update
sudo yum install -y java-1.8.0 wget 
mkdir Blynk

#Get Let's Encrypt certificate
chmod a+x certbot-auto
sudo yum install -y augeas-libs gcc libffi-devel openssl-devel python27-tools system-rpm-config
sudo  ./certbot-auto certonly -n --agree-tos --email --standalone -d --debug

sudo chmod 755 /etc/letsencrypt/live/
sudo chmod 755 /etc/letsencrypt/archive/

sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 9443
sudo service iptables save

echo "" >
echo "mail.smtp.auth=true" >>
echo "mail.smtp.starttls.enable=true" >>  >>
echo "" >>
echo "mail.smtp.port=587" >>
echo "mail.smtp.password=YOURPASSWORD" >>
echo "mail.smtp.connectiontimeout=30000" >>
echo "mail.smtp.timeout=120000" >>

echo "server.ssl.cert=/etc/letsencrypt/live/" >
echo "server.ssl.key=/etc/letsencrypt/live/" >>
echo "server.ssl.key.pass=" >>
echo "enable.db=true" >>
echo "" >>
(crontab -l 2>/dev/null; echo "@reboot java -jar server-0.40.2-java8.jar -dataFolder /home/ec2-user/Blynk &") | crontab -

mv create_schema.sql /tmp
mv reporting_schema.sql /tmp

sudo yum -y install postgresql96-server postgresql96 postgresql96-contrib
sudo service postgresql96 initdb
sudo sed -i.bak -e 's/ident$/password/' /var/lib/pgsql96/data/pg_hba.conf
sudo service postgresql96 start
sudo chkconfig postgresql96 on
sudo su - postgres
\i /tmp/create_schema.sql 
\i /tmp/reporting_schema.sql
sudo reboot


You don’t need this. Blynk server already has this feature. You need just correctly set and certificates will be automatically generated on initial start and renewed when necessary.

Automatic would be better and I really like that it takes care of the renewal.

When I first challenged myself to figure all this out I had problems with blynk server registering the certificates automatically so I just did it via the manual way. I’ve learned a lot since then and I’m pretty sure the issues I had when I started were FQDN-related. I’ll try doing it the automatic way and report back any issues or feedback that can help others.

The mentioned method prevent automatic letsencrypt update, as this proces also uses port 80 and 443, which are redirected to 8080 and 9443.
How do you handle renewal of certificate?