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?
To import existing resources into a CloudFormation stack, you need to provide: A template that describes the entire stack, including both the resources to import and (for existing stacks) the resources that are already part of the stack. Each resource to import must have a DeletionPolicy attribute in the template.
Review and download the CloudFormation template. Launch the CloudFormation Stack. Upload the CloudFormation template, and launch the stack to create the DynamoDB table. Verify the DynamoDB Table Was Created.
The latestStreamArn does not expire after 24 hours. A stream is created when you enable DynamoDB Streams either through a CreateTable or UpdateTable API call. latestStreamArn will change if you disable a DynamoDB stream and then re-enable it.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With