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.

gefragt vor 2 Jahren205 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen