Reference pre-existing DynamoDB table to retrieve Stream ARN

Is it possible to retrieve a Stream ARN for a table that is not created by the serverless.yml I’m writing? I’m working on a solution to replicate DynamoDB tables to Redshift using Firehose, but the tables weren’t created by me. All I really need is to create/enable the Stream in a given table and reference that stream ARN in my template somewhere else, or just retrieve an existing Stream ARN based on the table name.

So far I wasn’t able to figure out if Serverless allows me to reference a pre-existing DynamoDB table or not. If it doesn’t, I’m not able to fully automate the deployment and will need to provide the stream ARNs manually in my template, for each table and for each account I’ll use it.

Sure… You just need the arn of the dynamo stream. You can retrieve that via the AWS Console.
It’s listed on the Overview tab when you select the table.

Then in your function definition in serverless.yml add the arn to the stream event handler like so:

functions:
  myStreamHandler:
    timeout: 300
    handler: src/stream-handler.handle
    events:
      - stream:
        type: dynamodb
        arn: arn:aws:dynamodb:us-west-2:{your account}:table/{your table}/stream/2017-10-06T22:36:19.015

You’ll also need to ensure that you add an entry to your iamRoleStatment:

    - Effect: Allow
      Action:
        - dynamodb:GetRecords
        - dynamodb:GetShardIterator
        - dynamodb:DescribeStream
        - dynamodb:ListStreams
      Resource: arn:aws:dynamodb:us-west-2:{your account}:table/{your table}/stream/2017-10-06T22:36:19.015

The Stream arn is static unless you drop and re-create it(or the underlying table). When ti does change, only the date-time at the end of the arn. So be sure to update the arn on your handler if you alter the stream source.

Hope this helps.

I know I am late to this.
I was having the same problem, to automate the deployment I cannot copy and paste ARN again and again. Even asked this on StackOverflow
What I found was that we can basically do this by using AWS DynamoDB Describe Streams Method. link here: API_streams_DescribeStream
In case someone wants an implementation, I wrote a serverless plugin that fetches and attach ARN
link here: serverless-dynamodb-stream-arn-plugin