1. Packages
  2. AWS Classic
  3. API Docs
  4. dynamodb
  5. ResourcePolicy

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.dynamodb.ResourcePolicy

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Resource for managing an AWS DynamoDB Resource Policy.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.dynamodb.ResourcePolicy("example", {
        resourceArn: exampleAwsDynamodbTable.arn,
        policy: test.json,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.dynamodb.ResourcePolicy("example",
        resource_arn=example_aws_dynamodb_table["arn"],
        policy=test["json"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := dynamodb.NewResourcePolicy(ctx, "example", &dynamodb.ResourcePolicyArgs{
    			ResourceArn: pulumi.Any(exampleAwsDynamodbTable.Arn),
    			Policy:      pulumi.Any(test.Json),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.DynamoDB.ResourcePolicy("example", new()
        {
            ResourceArn = exampleAwsDynamodbTable.Arn,
            Policy = test.Json,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.dynamodb.ResourcePolicy;
    import com.pulumi.aws.dynamodb.ResourcePolicyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new ResourcePolicy("example", ResourcePolicyArgs.builder()
                .resourceArn(exampleAwsDynamodbTable.arn())
                .policy(test.json())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:dynamodb:ResourcePolicy
        properties:
          resourceArn: ${exampleAwsDynamodbTable.arn}
          policy: ${test.json}
    

    Create ResourcePolicy Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ResourcePolicy(name: string, args: ResourcePolicyArgs, opts?: CustomResourceOptions);
    @overload
    def ResourcePolicy(resource_name: str,
                       args: ResourcePolicyArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourcePolicy(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       policy: Optional[str] = None,
                       resource_arn: Optional[str] = None,
                       confirm_remove_self_resource_access: Optional[bool] = None)
    func NewResourcePolicy(ctx *Context, name string, args ResourcePolicyArgs, opts ...ResourceOption) (*ResourcePolicy, error)
    public ResourcePolicy(string name, ResourcePolicyArgs args, CustomResourceOptions? opts = null)
    public ResourcePolicy(String name, ResourcePolicyArgs args)
    public ResourcePolicy(String name, ResourcePolicyArgs args, CustomResourceOptions options)
    
    type: aws:dynamodb:ResourcePolicy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ResourcePolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ResourcePolicyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ResourcePolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourcePolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourcePolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var awsResourcePolicyResource = new Aws.DynamoDB.ResourcePolicy("awsResourcePolicyResource", new()
    {
        Policy = "string",
        ResourceArn = "string",
        ConfirmRemoveSelfResourceAccess = false,
    });
    
    example, err := dynamodb.NewResourcePolicy(ctx, "awsResourcePolicyResource", &dynamodb.ResourcePolicyArgs{
    	Policy:                          pulumi.String("string"),
    	ResourceArn:                     pulumi.String("string"),
    	ConfirmRemoveSelfResourceAccess: pulumi.Bool(false),
    })
    
    var awsResourcePolicyResource = new ResourcePolicy("awsResourcePolicyResource", ResourcePolicyArgs.builder()
        .policy("string")
        .resourceArn("string")
        .confirmRemoveSelfResourceAccess(false)
        .build());
    
    aws_resource_policy_resource = aws.dynamodb.ResourcePolicy("awsResourcePolicyResource",
        policy="string",
        resource_arn="string",
        confirm_remove_self_resource_access=False)
    
    const awsResourcePolicyResource = new aws.dynamodb.ResourcePolicy("awsResourcePolicyResource", {
        policy: "string",
        resourceArn: "string",
        confirmRemoveSelfResourceAccess: false,
    });
    
    type: aws:dynamodb:ResourcePolicy
    properties:
        confirmRemoveSelfResourceAccess: false
        policy: string
        resourceArn: string
    

    ResourcePolicy Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ResourcePolicy resource accepts the following input properties:

    Policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    ResourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    ConfirmRemoveSelfResourceAccess bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    Policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    ResourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    ConfirmRemoveSelfResourceAccess bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy String

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn String
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    confirmRemoveSelfResourceAccess Boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    confirmRemoveSelfResourceAccess boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy str

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resource_arn str
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    confirm_remove_self_resource_access bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy String

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn String
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    confirmRemoveSelfResourceAccess Boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ResourcePolicy resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    RevisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    Id string
    The provider-assigned unique ID for this managed resource.
    RevisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    id String
    The provider-assigned unique ID for this managed resource.
    revisionId String
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    id string
    The provider-assigned unique ID for this managed resource.
    revisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    id str
    The provider-assigned unique ID for this managed resource.
    revision_id str
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    id String
    The provider-assigned unique ID for this managed resource.
    revisionId String
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.

    Look up Existing ResourcePolicy Resource

    Get an existing ResourcePolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ResourcePolicyState, opts?: CustomResourceOptions): ResourcePolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            confirm_remove_self_resource_access: Optional[bool] = None,
            policy: Optional[str] = None,
            resource_arn: Optional[str] = None,
            revision_id: Optional[str] = None) -> ResourcePolicy
    func GetResourcePolicy(ctx *Context, name string, id IDInput, state *ResourcePolicyState, opts ...ResourceOption) (*ResourcePolicy, error)
    public static ResourcePolicy Get(string name, Input<string> id, ResourcePolicyState? state, CustomResourceOptions? opts = null)
    public static ResourcePolicy get(String name, Output<String> id, ResourcePolicyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ConfirmRemoveSelfResourceAccess bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    Policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    ResourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    RevisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    ConfirmRemoveSelfResourceAccess bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    Policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    ResourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    RevisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    confirmRemoveSelfResourceAccess Boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy String

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn String
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    revisionId String
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    confirmRemoveSelfResourceAccess boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy string

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn string
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    revisionId string
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    confirm_remove_self_resource_access bool
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy str

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resource_arn str
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    revision_id str
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.
    confirmRemoveSelfResourceAccess Boolean
    Set this parameter to true to confirm that you want to remove your permissions to change the policy of this resource in the future.
    policy String

    n Amazon Web Services resource-based policy document in JSON format. The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations.

    The following arguments are optional:

    resourceArn String
    The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy will be attached. The resources you can specify include tables and streams. You can control index permissions using the base table's policy. To specify the same permission level for your table and its indexes, you can provide both the table and index Amazon Resource Name (ARN)s in the Resource field of a given Statement in your policy document. Alternatively, to specify different permissions for your table, indexes, or both, you can define multiple Statement fields in your policy document.
    revisionId String
    A unique string that represents the revision ID of the policy. If you are comparing revision IDs, make sure to always use string comparison logic.

    Import

    Using pulumi import, import DynamoDB Resource Policy using the example_id_arg. For example:

    $ pulumi import aws:dynamodb/resourcePolicy:ResourcePolicy example arn:aws:dynamodb:us-east-1:1234567890:table/my-table
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi