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.

preguntada hace 2 años205 visualizaciones
1 Respuesta
0
Respuesta aceptada

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

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas