I am writing a plugin for the serverless framework, which references a DynamoDB Stream by its ARN. I can construct the DynamoDB tables ARN with the information I have at hand, but I don't know the timestamp part, that would be necessary to build the full stream ARN. I don't have access to the original DynamoDB Cloudformation definition, when I need to reference the Stream ARN, those two things can happen in entirely different templates. All I have is the ARN of the already created DynamoDB at this point.
Is there a way to reference the latest stream via a variable similar to arn:aws:dynamodb:${AWS::Region}::${AWS::AccountId}:table/eventbus-test/stream/${LATEST}?
Or can I build it in another way by means of a serverless configuration or Cloudformation template?
According to the doc. You can access it with the Fn::GetAtt intrinsic function with the StreamArn parameter. For example:
Resources:
Table:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: leaseKey
AttributeType: S
KeySchema:
- KeyType: HASH
AttributeName: leaseKey
ProvisionedThroughput:
ReadCapacityUnits: '1'
WriteCapacityUnits: '1'
Outputs:
TableStreamArn:
Value: !GetAtt Table.StreamArn