View a markdown version of this page

Ejemplo 4: Etiquetado de flujos con CloudFormation - Amazon DynamoDB

Ejemplo 4: Etiquetado de flujos con CloudFormation

Puede especificar etiquetas en DynamoDB Streams directamente en las plantillas de CloudFormation. Las etiquetas de flujo se definen dentro de la propiedad StreamSpecification de las tablas estándar y dentro de la propiedad ReplicaStreamSpecification de las tablas globales.

AWS::DynamoDB::Table

Resources: MyTable: Type: AWS::DynamoDB::Table Properties: TableName: MyTable AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH BillingMode: PAY_PER_REQUEST Tags: - Key: TableEnv Value: Production StreamSpecification: StreamViewType: NEW_AND_OLD_IMAGES Tags: - Key: StreamEnv Value: Production - Key: StreamTeam Value: Payments

AWS::DynamoDB::GlobalTable

Resources: MyGlobalTable: Type: AWS::DynamoDB::GlobalTable Properties: TableName: MyGlobalTable AttributeDefinitions: - AttributeName: id AttributeType: S KeySchema: - AttributeName: id KeyType: HASH BillingMode: PAY_PER_REQUEST StreamSpecification: StreamViewType: NEW_AND_OLD_IMAGES Replicas: - Region: us-east-1 Tags: - Key: TableEnv Value: Production ReplicaStreamSpecification: Tags: - Key: StreamEnv Value: Production - Key: StreamTeam Value: Payments - Region: eu-west-1 Tags: - Key: TableEnv Value: Production ReplicaStreamSpecification: Tags: - Key: StreamEnv Value: Production - Key: StreamTeam Value: Payments

Además de las etiquetas de flujo explícitas, CloudFormation también propaga etiquetas por pila a los flujos. Si la pila tiene etiquetas configuradas, esas etiquetas se aplican automáticamente a todos los recursos de la pila, incluidos los flujos.

importante

El rol de IAM utilizado para la implementación de CloudFormation debe tener permisos dynamodb:TagResource y dynamodb:UntagResource en los recursos de flujo (arn:aws:dynamodb:*:*:table/*/stream/*) para aplicar etiquetas a los flujos. Si faltan estos permisos, consulte Las implementaciones de CloudFormation producen un error al etiquetar transmisiones para obtener más información.