LoginSignup
39
39

More than 5 years have passed since last update.

AWS CloudFront用にSSL証明書をアップロードする

Posted at

CloudFrontは便利なコンテンツ配信ネットワークですが、独自ドメインでSSL通信を行うには、AWSにSSL証明書をアップロードしなければいけません。アップロードにはAWSのコマンドラインインターフェースを用います。ホームフォルダにpemというフォルダを作り、そこに証明書、秘密鍵、中間証明書を置いて、場所を指定します。

aws iam upload-server-certificate --server-certificate-name {適当な名前} --certificate-body ~/pem/cert.pem --private-key ~/pem/key.pem --certificate-chain ~/pem/inter.pem --path /cloudfront/{適当な名前}/

すると以下のようなエラーが

A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to parse certificate. Please ensure the certificate is in PEM format.

ポイントは file:// を付けることでした。

aws iam upload-server-certificate --server-certificate-name {適当な名前} --certificate-body file://cert.pem --private-key file://key.pem --certificate-chain file://inter.pem --path /cloudfront/{適当な名前}/

証明書ファイルが置いてあるフォルダまで移動し、上記のコマンドを打ちました。これで証明書のアップロードができました。
file://を付ける点がはまりどころだったので、メモ代わりに残しておきます。

39
39
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
39
39