Skip to content

Instantly share code, notes, and snippets.

@zxkane
Created December 13, 2023 02:21
Show Gist options
  • Select an option

  • Save zxkane/e90de06b339f3c9d02ca63edfadbb4c9 to your computer and use it in GitHub Desktop.

Select an option

Save zxkane/e90de06b339f3c9d02ca63edfadbb4c9 to your computer and use it in GitHub Desktop.

Revisions

  1. zxkane created this gist Dec 13, 2023.
    12 changes: 12 additions & 0 deletions 1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # install tools
    pip3 install certbot acme certbot-dns-route53

    #
    export DOMAIN_NAME=clickstream.example.com
    export CERT_NAME=$DOMAIN_NAME-$(/bin/date +%s)

    # request fress SSL cert via DNS chanllege
    certbot certonly --dns-route53 -d $DOMAIN_NAME --email [email protected] --agree-tos --non-interactive --work-dir ./ --logs-dir ./ --config-dir ./ -v

    # upload cert to IAM
    aws iam upload-server-certificate --server-certificate-name $CERT_NAME --certificate-body file:/live/$DOMAIN_NAME/cert.pem --private-key file:/live/$DOMAIN_NAME/privkey.pem --certificate-chain file:/live/$DOMAIN_NAME/chain.pem --path /cloudfront/clickstream/ | jq '.ServerCertificateMetadata.ServerCertificateId' --raw-output