Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

250
Visualizações
Send DynamoDB arn from JS file to serverless

With a JS script, I retrieve the stream arn from my DynamoDB table.

I will like to send this arn to serverless.yml file to use it in my function.

My serverless version:

$ serverless -v
Framework Core: 2.71.0 (standalone)
Plugin: 5.5.3
SDK: 4.3.0
Components: 3.18.1

My JS script works:

"use strict";

const AWS = require("aws-sdk");

async function run() {
    const region = 'eu-west-3';
    const tableName = 'dev-Connect-TrzConnect';
    const dynamoDBStreams = await getDynamoDBStreams(region, tableName);
    let streamArn = null;

    dynamoDBStreams.Streams.forEach((stream) => {
        streamArn = stream.StreamArn;
    })

    return streamArn;
}

const getDynamoDBStreams = async (region, tableName) => {
    const dynamoStreams = new AWS.DynamoDBStreams({
        region: region,
    });
    const params = {
        TableName: tableName,
    };
    return dynamoStreams.listStreams(params).promise();
};

run().then((r) => console.log(r))

Now, I have no idea how to retrieve the value of streamArn variable in serverless.yml and, use it there:

functions:
  createStatementFiles:
    handler: lambda/statement.php
    timeout: 899 # 14min 59s
    layers:
      - arn:aws:lambda:#{AWS::Region}:<account_id>:layer:php-73:1
    role: CreateStatementFilesRole
    reservedConcurrency: 10
    events:
      - stream:
          type: dynamodb
          arn: ${streamArn}
          filterPatterns:
            - eventName: [INSERT]
              dynamodb:
                NewImage:
                  __partitionKey:
                    S: [statementBalance]

I search to have something like this:

  - stream:
      type: dynamodb
      arn: ${streamArn}

I read this documentation https://www.serverless.com/framework/docs/guides/plugins/creating-plugins but I did not understand at all how to solve my need.

Can you please help me ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda