Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active March 23, 2018 01:35
Show Gist options
  • Save pahud/84c1ae14497cd773f3ce9830664710dc to your computer and use it in GitHub Desktop.
Save pahud/84c1ae14497cd773f3ce9830664710dc to your computer and use it in GitHub Desktop.
AWS IAM upload-server-certificate example
#!/bin/bash
aws iam upload-server-certificate \
--server-certificate-name my-cert-name \
--certificate-body file://cert.pem \
--private-key file://privkey.pem \
--certificate-chain file://chain.pem
@pahud
Copy link
Author

pahud commented Apr 10, 2016

then you got the response like this

{
    "ServerCertificateMetadata": {
        "ServerCertificateId": "{CertificateId}", 
        "ServerCertificateName": "{CertificateName}", 
        "Expiration": "{ExpirationTime}", 
        "Path": "/", 
        "Arn": "arn:aws:iam::{aws_account_id}:server-certificate/{certificate_name}", 
        "UploadDate": "2016-04-10T03:00:34.402Z"
    }
}

@pahud
Copy link
Author

pahud commented Oct 17, 2016

always prepend /cloudfront/ to the path of the certificate

  1. http://docs.aws.amazon.com/cli/latest/reference/iam/upload-server-certificate.html
  2. aws iam upload-server-certificate --server-certificate-name CertificateName --certificate-body file://public_key_certificate_file --private-key file://privatekey.pem --certificate-chain file://certificate_chain_file --path /cloudfront/DistributionName/
  3. aws iam update-server-certificate --server-certificate-name CertificateName --new-path /cloudfront/DistributionName/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment