Skip to content

Commit

Permalink
Enable HTTPS on aws for single-instance (#417)
Browse files Browse the repository at this point in the history
* Add ebextension config to get ssl certs
- https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-storingprivatekeys.html

* Add nginx conf to allow HTTPS
- Config is created by modifying default nginx conf for HTTP
  • Loading branch information
ravisumit33 authored May 6, 2023
1 parent 42bfa75 commit e412f51
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .ebextensions/single-instance-ssl.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Auth:
type: "s3"
buckets: ["mysterio-ssl"]
roleName:
"Fn::GetOptionSetting":
Namespace: "aws:autoscaling:launchconfiguration"
OptionName: "IamInstanceProfile"
DefaultValue: "aws-elasticbeanstalk-ec2-role"
files:
"/etc/pki/tls/certs/mysterio.com.key":
mode: "000400"
owner: root
group: root
authentication: "S3Auth"
source: https://mysterio-ssl.s3.ap-south-1.amazonaws.com/mysterio.com.key
"/etc/pki/tls/certs/mysterio.com.pem":
mode: "000400"
owner: root
group: root
authentication: "S3Auth"
source: https://mysterio-ssl.s3.ap-south-1.amazonaws.com/mysterio.com.pem
16 changes: 16 additions & 0 deletions .platform/nginx/conf.d/ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
server {
listen 443 default_server ssl;
ssl_certificate /etc/pki/tls/certs/mysterio.com.pem;
ssl_certificate_key /etc/pki/tls/certs/mysterio.com.key;
access_log /var/log/nginx/access_ssl.log main;

client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/*.conf;
}

0 comments on commit e412f51

Please sign in to comment.