ResourcePolicyProperty Struct
Creates or updates a resource-based policy document that contains the permissions for DynamoDB resources, such as a table, its indexes, and stream.
Resource-based policies let you define access permissions by specifying who has access to each resource, and the actions they are allowed to perform on each resource.
In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples .
While defining resource-based policies in your CloudFormation templates, the following considerations apply:
- The maximum size supported for a resource-based policy document in JSON format is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit.
- Resource-based policies don't support drift detection . If you update a policy outside of the CloudFormation stack template, you'll need to update the CloudFormation stack with the changes.
- Resource-based policies don't support out-of-band changes. If you add, update, or delete a policy outside of the CloudFormation template, the change won't be overwritten if there are no changes to the policy within the template.
For example, say that your template contains a resource-based policy, which you later update outside of the template. If you don't make any changes to the policy in the template, the updated policy in DynamoDB won’t be synced with the policy in the template.
Conversely, say that your template doesn’t contain a resource-based policy, but you add a policy outside of the template. This policy won’t be removed from DynamoDB as long as you don’t add it to the template. When you add a policy to the template and update the stack, the existing policy in DynamoDB will be updated to match the one defined in the template.
For a full list of all considerations, see Resource-based policy considerations .
| Source | |
|---|---|
| Type last changed |
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
declare const policyDocument: any;
const resourcePolicyProperty: dynamodb.CfnTable.ResourcePolicyProperty = {
policyDocument: policyDocument,
};
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_dynamodb as dynamodb
# policy_document: Any
resource_policy_property = dynamodb.CfnTable.ResourcePolicyProperty(
policy_document=policy_document
)
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.dynamodb.*;
Object policyDocument;
ResourcePolicyProperty resourcePolicyProperty = ResourcePolicyProperty.builder()
.policyDocument(policyDocument)
.build();
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.DynamoDB;
var policyDocument;
var resourcePolicyProperty = new ResourcePolicyProperty {
PolicyDocument = policyDocument
};
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
var policyDocument interface{}
resourcePolicyProperty := &ResourcePolicyProperty{
PolicyDocument: policyDocument,
}
Properties
policyDocumentanypolicy_documentAnypolicyDocumentObjectPolicyDocumentobjectPolicyDocumentinterface{} required #notes
In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples .