1. Packages
  2. AWS Classic
  3. API Docs
  4. ssm
  5. ResourceDataSync

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

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

aws.ssm.ResourceDataSync

Explore with Pulumi AI

aws logo

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

AWS Classic v5.41.0 published on Monday, May 15, 2023 by Pulumi

    Provides a SSM resource data sync.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var hogeBucketV2 = new Aws.S3.BucketV2("hogeBucketV2");
    
        var hogePolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Sid = "SSMBucketPermissionsCheck",
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "ssm.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "s3:GetBucketAcl",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::tf-test-bucket-1234",
                    },
                },
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Sid = "SSMBucketDelivery",
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "ssm.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "s3:PutObject",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::tf-test-bucket-1234/*",
                    },
                    Conditions = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
                        {
                            Test = "StringEquals",
                            Variable = "s3:x-amz-acl",
                            Values = new[]
                            {
                                "bucket-owner-full-control",
                            },
                        },
                    },
                },
            },
        });
    
        var hogeBucketPolicy = new Aws.S3.BucketPolicy("hogeBucketPolicy", new()
        {
            Bucket = hogeBucketV2.Id,
            Policy = hogePolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var foo = new Aws.Ssm.ResourceDataSync("foo", new()
        {
            S3Destination = new Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs
            {
                BucketName = hogeBucketV2.Bucket,
                Region = hogeBucketV2.Region,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
    	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		hogeBucketV2, err := s3.NewBucketV2(ctx, "hogeBucketV2", nil)
    		if err != nil {
    			return err
    		}
    		hogePolicyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Sid:    pulumi.StringRef("SSMBucketPermissionsCheck"),
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"ssm.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"s3:GetBucketAcl",
    					},
    					Resources: []string{
    						"arn:aws:s3:::tf-test-bucket-1234",
    					},
    				},
    				{
    					Sid:    pulumi.StringRef("SSMBucketDelivery"),
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"ssm.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"s3:PutObject",
    					},
    					Resources: []string{
    						"arn:aws:s3:::tf-test-bucket-1234/*",
    					},
    					Conditions: []iam.GetPolicyDocumentStatementCondition{
    						{
    							Test:     "StringEquals",
    							Variable: "s3:x-amz-acl",
    							Values: []string{
    								"bucket-owner-full-control",
    							},
    						},
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketPolicy(ctx, "hogeBucketPolicy", &s3.BucketPolicyArgs{
    			Bucket: hogeBucketV2.ID(),
    			Policy: *pulumi.String(hogePolicyDocument.Json),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ssm.NewResourceDataSync(ctx, "foo", &ssm.ResourceDataSyncArgs{
    			S3Destination: &ssm.ResourceDataSyncS3DestinationArgs{
    				BucketName: hogeBucketV2.Bucket,
    				Region:     hogeBucketV2.Region,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.iam.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.s3.BucketPolicy;
    import com.pulumi.aws.s3.BucketPolicyArgs;
    import com.pulumi.aws.ssm.ResourceDataSync;
    import com.pulumi.aws.ssm.ResourceDataSyncArgs;
    import com.pulumi.aws.ssm.inputs.ResourceDataSyncS3DestinationArgs;
    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 hogeBucketV2 = new BucketV2("hogeBucketV2");
    
            final var hogePolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(            
                    GetPolicyDocumentStatementArgs.builder()
                        .sid("SSMBucketPermissionsCheck")
                        .effect("Allow")
                        .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                            .type("Service")
                            .identifiers("ssm.amazonaws.com")
                            .build())
                        .actions("s3:GetBucketAcl")
                        .resources("arn:aws:s3:::tf-test-bucket-1234")
                        .build(),
                    GetPolicyDocumentStatementArgs.builder()
                        .sid("SSMBucketDelivery")
                        .effect("Allow")
                        .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                            .type("Service")
                            .identifiers("ssm.amazonaws.com")
                            .build())
                        .actions("s3:PutObject")
                        .resources("arn:aws:s3:::tf-test-bucket-1234/*")
                        .conditions(GetPolicyDocumentStatementConditionArgs.builder()
                            .test("StringEquals")
                            .variable("s3:x-amz-acl")
                            .values("bucket-owner-full-control")
                            .build())
                        .build())
                .build());
    
            var hogeBucketPolicy = new BucketPolicy("hogeBucketPolicy", BucketPolicyArgs.builder()        
                .bucket(hogeBucketV2.id())
                .policy(hogePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
            var foo = new ResourceDataSync("foo", ResourceDataSyncArgs.builder()        
                .s3Destination(ResourceDataSyncS3DestinationArgs.builder()
                    .bucketName(hogeBucketV2.bucket())
                    .region(hogeBucketV2.region())
                    .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    hoge_bucket_v2 = aws.s3.BucketV2("hogeBucketV2")
    hoge_policy_document = aws.iam.get_policy_document(statements=[
        aws.iam.GetPolicyDocumentStatementArgs(
            sid="SSMBucketPermissionsCheck",
            effect="Allow",
            principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
                type="Service",
                identifiers=["ssm.amazonaws.com"],
            )],
            actions=["s3:GetBucketAcl"],
            resources=["arn:aws:s3:::tf-test-bucket-1234"],
        ),
        aws.iam.GetPolicyDocumentStatementArgs(
            sid="SSMBucketDelivery",
            effect="Allow",
            principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
                type="Service",
                identifiers=["ssm.amazonaws.com"],
            )],
            actions=["s3:PutObject"],
            resources=["arn:aws:s3:::tf-test-bucket-1234/*"],
            conditions=[aws.iam.GetPolicyDocumentStatementConditionArgs(
                test="StringEquals",
                variable="s3:x-amz-acl",
                values=["bucket-owner-full-control"],
            )],
        ),
    ])
    hoge_bucket_policy = aws.s3.BucketPolicy("hogeBucketPolicy",
        bucket=hoge_bucket_v2.id,
        policy=hoge_policy_document.json)
    foo = aws.ssm.ResourceDataSync("foo", s3_destination=aws.ssm.ResourceDataSyncS3DestinationArgs(
        bucket_name=hoge_bucket_v2.bucket,
        region=hoge_bucket_v2.region,
    ))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const hogeBucketV2 = new aws.s3.BucketV2("hogeBucketV2", {});
    const hogePolicyDocument = aws.iam.getPolicyDocument({
        statements: [
            {
                sid: "SSMBucketPermissionsCheck",
                effect: "Allow",
                principals: [{
                    type: "Service",
                    identifiers: ["ssm.amazonaws.com"],
                }],
                actions: ["s3:GetBucketAcl"],
                resources: ["arn:aws:s3:::tf-test-bucket-1234"],
            },
            {
                sid: "SSMBucketDelivery",
                effect: "Allow",
                principals: [{
                    type: "Service",
                    identifiers: ["ssm.amazonaws.com"],
                }],
                actions: ["s3:PutObject"],
                resources: ["arn:aws:s3:::tf-test-bucket-1234/*"],
                conditions: [{
                    test: "StringEquals",
                    variable: "s3:x-amz-acl",
                    values: ["bucket-owner-full-control"],
                }],
            },
        ],
    });
    const hogeBucketPolicy = new aws.s3.BucketPolicy("hogeBucketPolicy", {
        bucket: hogeBucketV2.id,
        policy: hogePolicyDocument.then(hogePolicyDocument => hogePolicyDocument.json),
    });
    const foo = new aws.ssm.ResourceDataSync("foo", {s3Destination: {
        bucketName: hogeBucketV2.bucket,
        region: hogeBucketV2.region,
    }});
    
    resources:
      hogeBucketV2:
        type: aws:s3:BucketV2
      hogeBucketPolicy:
        type: aws:s3:BucketPolicy
        properties:
          bucket: ${hogeBucketV2.id}
          policy: ${hogePolicyDocument.json}
      foo:
        type: aws:ssm:ResourceDataSync
        properties:
          s3Destination:
            bucketName: ${hogeBucketV2.bucket}
            region: ${hogeBucketV2.region}
    variables:
      hogePolicyDocument:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - sid: SSMBucketPermissionsCheck
                effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - ssm.amazonaws.com
                actions:
                  - s3:GetBucketAcl
                resources:
                  - arn:aws:s3:::tf-test-bucket-1234
              - sid: SSMBucketDelivery
                effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - ssm.amazonaws.com
                actions:
                  - s3:PutObject
                resources:
                  - arn:aws:s3:::tf-test-bucket-1234/*
                conditions:
                  - test: StringEquals
                    variable: s3:x-amz-acl
                    values:
                      - bucket-owner-full-control
    

    Create ResourceDataSync Resource

    new ResourceDataSync(name: string, args: ResourceDataSyncArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceDataSync(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         name: Optional[str] = None,
                         s3_destination: Optional[ResourceDataSyncS3DestinationArgs] = None)
    @overload
    def ResourceDataSync(resource_name: str,
                         args: ResourceDataSyncArgs,
                         opts: Optional[ResourceOptions] = None)
    func NewResourceDataSync(ctx *Context, name string, args ResourceDataSyncArgs, opts ...ResourceOption) (*ResourceDataSync, error)
    public ResourceDataSync(string name, ResourceDataSyncArgs args, CustomResourceOptions? opts = null)
    public ResourceDataSync(String name, ResourceDataSyncArgs args)
    public ResourceDataSync(String name, ResourceDataSyncArgs args, CustomResourceOptions options)
    
    type: aws:ssm:ResourceDataSync
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ResourceDataSyncArgs
    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 ResourceDataSyncArgs
    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 ResourceDataSyncArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceDataSyncArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceDataSyncArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ResourceDataSync 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 ResourceDataSync resource accepts the following input properties:

    S3Destination Pulumi.Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    Name string

    Name for the configuration.

    S3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    Name string

    Name for the configuration.

    s3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name String

    Name for the configuration.

    s3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name string

    Name for the configuration.

    s3_destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name str

    Name for the configuration.

    s3Destination Property Map

    Amazon S3 configuration details for the sync.

    name String

    Name for the configuration.

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing ResourceDataSync Resource

    Get an existing ResourceDataSync 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?: ResourceDataSyncState, opts?: CustomResourceOptions): ResourceDataSync
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            s3_destination: Optional[ResourceDataSyncS3DestinationArgs] = None) -> ResourceDataSync
    func GetResourceDataSync(ctx *Context, name string, id IDInput, state *ResourceDataSyncState, opts ...ResourceOption) (*ResourceDataSync, error)
    public static ResourceDataSync Get(string name, Input<string> id, ResourceDataSyncState? state, CustomResourceOptions? opts = null)
    public static ResourceDataSync get(String name, Output<String> id, ResourceDataSyncState 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:
    Name string

    Name for the configuration.

    S3Destination Pulumi.Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    Name string

    Name for the configuration.

    S3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name String

    Name for the configuration.

    s3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name string

    Name for the configuration.

    s3Destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name str

    Name for the configuration.

    s3_destination ResourceDataSyncS3DestinationArgs

    Amazon S3 configuration details for the sync.

    name String

    Name for the configuration.

    s3Destination Property Map

    Amazon S3 configuration details for the sync.

    Supporting Types

    ResourceDataSyncS3Destination

    BucketName string

    Name of S3 bucket where the aggregated data is stored.

    Region string

    Region with the bucket targeted by the Resource Data Sync.

    KmsKeyArn string

    ARN of an encryption key for a destination in Amazon S3.

    Prefix string

    Prefix for the bucket.

    SyncFormat string

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    BucketName string

    Name of S3 bucket where the aggregated data is stored.

    Region string

    Region with the bucket targeted by the Resource Data Sync.

    KmsKeyArn string

    ARN of an encryption key for a destination in Amazon S3.

    Prefix string

    Prefix for the bucket.

    SyncFormat string

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    bucketName String

    Name of S3 bucket where the aggregated data is stored.

    region String

    Region with the bucket targeted by the Resource Data Sync.

    kmsKeyArn String

    ARN of an encryption key for a destination in Amazon S3.

    prefix String

    Prefix for the bucket.

    syncFormat String

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    bucketName string

    Name of S3 bucket where the aggregated data is stored.

    region string

    Region with the bucket targeted by the Resource Data Sync.

    kmsKeyArn string

    ARN of an encryption key for a destination in Amazon S3.

    prefix string

    Prefix for the bucket.

    syncFormat string

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    bucket_name str

    Name of S3 bucket where the aggregated data is stored.

    region str

    Region with the bucket targeted by the Resource Data Sync.

    kms_key_arn str

    ARN of an encryption key for a destination in Amazon S3.

    prefix str

    Prefix for the bucket.

    sync_format str

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    bucketName String

    Name of S3 bucket where the aggregated data is stored.

    region String

    Region with the bucket targeted by the Resource Data Sync.

    kmsKeyArn String

    ARN of an encryption key for a destination in Amazon S3.

    prefix String

    Prefix for the bucket.

    syncFormat String

    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    Import

    SSM resource data sync can be imported using the name, e.g.,

     $ pulumi import aws:ssm/resourceDataSync:ResourceDataSync example example-name
    

    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 v5.41.0 published on Monday, May 15, 2023 by Pulumi