LoginSignup
3
0

More than 1 year has passed since last update.

aws cli v2で"Invalid base64"が出た時の対応方法

Posted at

kms encryptで暗号化する際の出来事。
aws cli v2を使用している場合、エンコードで使用される文字コードがv1から変わっているのでエラーが出る。
v1と同じように出力するためには「--cli-binary-format raw-in-base64-out」を追加する

$ aws --version
aws-cli/2.1.14 Python/3.7.4 Darwin/19.6.0 exe/x86_64 prompt/off

$ aws kms encrypt --key-id alias/hoge --plaintext "hoge/hoge"
Invalid base64: "hoge/hoge"$ aws kms encrypt --cli-binary-format raw-in-base64-out --key-id alias/hoge --plaintext "hoge/hoge"
{
    "CiphertextBlob": "AQICAHgRiong2g/42V4cr7XORzdNrTD5fP0itLwSUgnU...",
    "KeyId": "arn:aws:kms:ap-northeast-1:XXXXXXXXXXX:key/XXXXXXX-XXXXX",
    "EncryptionAlgorithm": "SYMMETRIC_DEFAULT"
}

3
0
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
3
0