Skip to content

Instantly share code, notes, and snippets.

@harshpatel991
Last active August 2, 2017 14:08
Show Gist options
  • Select an option

  • Save harshpatel991/aa7c060029df83d04a3c744474e98d4a to your computer and use it in GitHub Desktop.

Select an option

Save harshpatel991/aa7c060029df83d04a3c744474e98d4a to your computer and use it in GitHub Desktop.
AWS Elastic Beanstalk config for signed SSL certificate using a single instance with Lets Encrypt certbot and apache.
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
packages:
yum:
mod24_ssl : []
epel-release: []
container_commands:
00_createdir:
command: "sudo mkdir /opt/certbot || true"
01_downloadcertbot:
command: "sudo wget -O /opt/certbot/certbot-auto https://dl.eff.org/certbot-auto;sudo chmod a+x /opt/certbot/certbot-auto"
03_createinitialcert:
command: "sudo /opt/certbot/certbot-auto --debug --non-interactive --apache --email ${CERT_EMAIL} --agree-tos --domains ${CERT_DOMAIN} --keep-until-expiring --apache-vhost-root /etc/httpd/conf.d/ssl.conf"
04_cron_renew:
command: "echo -e \"30 2,14 * * * root /opt/certbot/certbot-auto renew --no-self-upgrade\n\" > /etc/cron.d/certificate_renew && chmod 644 /etc/cron.d/certificate_renew"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment