Create & Upload SSL Certificate
AWS has a great step by step guide to creating and uploading a SSL certificate. You’ll have to download some command line tools: IAM CLI & Java Development Kit (JDK). For Mac OS X users, make sure you download the Mac OS X x65 binary, not the Linux binaries. The JAVA_HOME path for that Java install will be export JAVA_HOME=/Library/Java/Home
.
After the tools are setup, the guide will step you through creating a private key and certificate signing request to creating an IAM profile with your signed certificate. What isn’t very well documented, however, is how to setup a permanent redirect from http://YOURSITE to https://YOURSITE for your application that is deployed with Elastic Beanstalk.
Redirect http to https through .htacess
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTP_HOST} \. RewriteRule . https://%{SERVER_NAME}%{REQUEST_URI} [L,R] </IfModule>
Make sure to change /status
to whatever you’ve set your Application Health Check URL for your environment configuration inside Elastic Beanstalk.