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.

feita há 2 anos205 visualizações
1 Resposta
0
Resposta aceita

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

respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas