How to create Binary attribute value in aws-sdk-php for dynamodb putItem

0

I have a hex representation of a binary value (e.g. "ed634d...").

Using the aws-sdk-php to deal with a dynamoDB PutItem call, how would I feed that value to it? How do I need to convert it for DynamoDB to recognize it as the bytes that are the source for that hex representation?

        $this->client->putItem([
            'Item' => [
                'encryptedCredentials' => [
            //  This doesn't work. What binary representation would work here?
                    'B' => 'ed634d...',
                ],
  • What exception are you getting?

  • I was given the answer. I needed to use 'B' => hex2bin('ed634d...'),

  • @Leeroy Hannigan I wasn't actually getting an exception. However, another script that needed that value was choking on it.

    I've posted the solution as an answer below.

質問済み 2年前205ビュー
1回答
0
承認された回答

I was given the answer. I needed to use
'B' => hex2bin('ed634d...'),

回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ