コード例 #1
0
 public MyStack()
 {
     var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
         ObjectLockConfiguration = new Aws.S3.Inputs.BucketObjectLockConfigurationArgs
         {
             ObjectLockEnabled = "Enabled",
         },
         Versioning = new Aws.S3.Inputs.BucketVersioningArgs
         {
             Enabled = true,
         },
     });
     var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket       = examplebucket.Id,
         ForceDestroy = true,
         Key          = "someobject",
         ObjectLockLegalHoldStatus = "ON",
         ObjectLockMode            = "GOVERNANCE",
         ObjectLockRetainUntilDate = "2021-12-31T23:59:60Z",
         Source = new FileAsset("important.txt"),
     });
 }
コード例 #2
0
    public MyStack()
    {
        var master = new Aws.GuardDuty.Detector("master", new Aws.GuardDuty.DetectorArgs
        {
            Enable = true,
        });
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
            Acl = "private",
        });
        var myIPSetBucketObject = new Aws.S3.BucketObject("myIPSetBucketObject", new Aws.S3.BucketObjectArgs
        {
            Acl     = "public-read",
            Bucket  = bucket.Id,
            Content = @"10.0.0.0/8

",
            Key     = "MyIPSet",
        });
        var myIPSetIPSet = new Aws.GuardDuty.IPSet("myIPSetIPSet", new Aws.GuardDuty.IPSetArgs
        {
            Activate   = true,
            DetectorId = master.Id,
            Format     = "TXT",
            Location   = Output.Tuple(myIPSetBucketObject.Bucket, myIPSetBucketObject.Key).Apply(values =>
            {
                var bucket = values.Item1;
                var key    = values.Item2;
                return($"https://s3.amazonaws.com/{bucket}/{key}");
            }),
        });
    }
コード例 #3
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
    public MyStack()
    {
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
        });
        var bucketPolicy = new Aws.S3.BucketPolicy("bucketPolicy", new Aws.S3.BucketPolicyArgs
        {
            Bucket = bucket.Id,
            Policy = @"{
  ""Version"": ""2012-10-17"",
  ""Id"": ""MYBUCKETPOLICY"",
  ""Statement"": [
    {
      ""Sid"": ""IPAllow"",
      ""Effect"": ""Deny"",
      ""Principal"": ""*"",
      ""Action"": ""s3:*"",
      ""Resource"": ""arn:aws:s3:::my_tf_test_bucket/*"",
      ""Condition"": {
         ""IpAddress"": {""aws:SourceIp"": ""8.8.8.8/32""}
      }
    }
  ]
}

",
        });
    }
コード例 #4
0
 public MyStack()
 {
     var currentUser = Output.Create(Aws.GetCanonicalUserId.InvokeAsync());
     var bucket      = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
     {
         Grants =
         {
             new Aws.S3.Inputs.BucketGrantArgs
             {
                 Id          = currentUser.Apply(currentUser => currentUser.Id),
                 Permissions =
                 {
                     "FULL_CONTROL",
                 },
                 Type = "CanonicalUser",
             },
             new Aws.S3.Inputs.BucketGrantArgs
             {
                 Permissions =
                 {
                     "READ",
                     "WRITE",
                 },
                 Type = "Group",
                 Uri  = "http://acs.amazonaws.com/groups/s3/LogDelivery",
             },
         },
     });
 }
コード例 #5
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
    public MyStack()
    {
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
            Acl = "private",
        });
        var firehoseRole = new Aws.Iam.Role("firehoseRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""firehose.amazonaws.com""
      },
      ""Effect"": ""Allow"",
      ""Sid"": """"
    }
  ]
}

",
        });
        var testStream = new Aws.Kinesis.FirehoseDeliveryStream("testStream", new Aws.Kinesis.FirehoseDeliveryStreamArgs
        {
            Destination     = "s3",
            S3Configuration = new Aws.Kinesis.Inputs.FirehoseDeliveryStreamS3ConfigurationArgs
            {
                BucketArn = bucket.Arn,
                RoleArn   = firehoseRole.Arn,
            },
        });
    }
コード例 #6
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
    public MyStack()
    {
        var exampleBucket = new Aws.S3.Bucket("exampleBucket", new Aws.S3.BucketArgs
        {
            Acl = "private",
        });
        var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Effect"": ""Allow"",
      ""Principal"": {
        ""Service"": ""codebuild.amazonaws.com""
      },
      ""Action"": ""sts:AssumeRole""
    }
  ]
}

",
        });
        var exampleRolePolicy = new Aws.Iam.RolePolicy("exampleRolePolicy", new Aws.Iam.RolePolicyArgs
        {
            Policy = Output.Tuple(exampleBucket.Arn, exampleBucket.Arn).Apply(values =>
            {
                var exampleBucketArn  = values.Item1;
                var exampleBucketArn1 = values.Item2;
                return(@$ "{{
  " "Version" ": " "2012-10-17" ",
  " "Statement" ": [
コード例 #7
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var testBucket = new Aws.S3.Bucket("testBucket", new Aws.S3.BucketArgs
     {
     });
     var inventory = new Aws.S3.Bucket("inventory", new Aws.S3.BucketArgs
     {
     });
     var testInventory = new Aws.S3.Inventory("testInventory", new Aws.S3.InventoryArgs
     {
         Bucket      = testBucket.Id,
         Destination = new Aws.S3.Inputs.InventoryDestinationArgs
         {
             Bucket = new Aws.S3.Inputs.InventoryDestinationBucketArgs
             {
                 BucketArn = inventory.Arn,
                 Format    = "ORC",
             },
         },
         IncludedObjectVersions = "All",
         Schedule = new Aws.S3.Inputs.InventoryScheduleArgs
         {
             Frequency = "Daily",
         },
     });
 }
コード例 #8
0
 public MyStack()
 {
     var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
     {
         Acl       = "public-read",
         CorsRules =
         {
             new Aws.S3.Inputs.BucketCorsRuleArgs
             {
                 AllowedHeaders =
                 {
                     "*",
                 },
                 AllowedMethods =
                 {
                     "PUT",
                     "POST",
                 },
                 AllowedOrigins =
                 {
                     "https://s3-website-test.mydomain.com",
                 },
                 ExposeHeaders =
                 {
                     "ETag",
                 },
                 MaxAgeSeconds = 3000,
             },
         },
     });
 }
コード例 #9
0
    static Task Main()
    {
        return(Deployment.RunAsync(() =>
        {
            // Create a KMS Key for S3 server-side encryption
            var key = new Aws.Kms.Key("hello-world-key");

            // Create an AWS resource (S3 Bucket)
            var bucket = new Aws.S3.Bucket("hello-world-bucket", new Aws.S3.BucketArgs
            {
                ServerSideEncryptionConfiguration = new Aws.S3.Inputs.BucketServerSideEncryptionConfigurationArgs
                {
                    Rule = new Aws.S3.Inputs.BucketServerSideEncryptionConfigurationRuleArgs
                    {
                        ApplyServerSideEncryptionByDefault = new Aws.S3.Inputs.BucketServerSideEncryptionConfigurationRuleApplyServerSideEncryptionByDefaultArgs
                        {
                            SseAlgorithm = "aws:kms",
                            KmsMasterKeyId = key.Id,
                        },
                    },
                },
            });
            // Export the name of the bucket
            return new Dictionary <string, object> {
                { "bucket_name", bucket.Id },
            };
        }));
    }
コード例 #10
0
    public MyStack()
    {
        var config  = new Pulumi.Config();
        var siteDir = config.Get("siteDir");

        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs
        {
            Website = new BucketWebsiteArgs
            {
                IndexDocument = "index.html",
            }
        });

        this.BucketName      = bucket.BucketName;
        this.WebsiteEndpoint = bucket.WebsiteEndpoint;

        var bucketFile   = Path.Combine(siteDir, "index.html");
        var bucketObject = new Aws.S3.BucketObject("index.html", new BucketObjectArgs
        {
            Bucket      = bucket.BucketName,
            Source      = new FileAsset(bucketFile),
            Acl         = "public-read",
            ContentType = "text/html",
        });
    }
コード例 #11
0
    public MyStack()
    {
        var config  = new Pulumi.Config();
        var siteDir = config.Get("siteDir");

        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs
        {
            Website = new BucketWebsiteArgs
            {
                IndexDocument = "index.html",
            }
        });

        this.BucketName      = bucket.BucketName;
        this.WebsiteEndpoint = bucket.WebsiteEndpoint;

        foreach (var file in Directory.EnumerateFiles(siteDir))
        {
            var name         = Path.GetFileName(file);
            var bucketObject = new Aws.S3.BucketObject(name, new BucketObjectArgs
            {
                Bucket      = bucket.BucketName,
                Source      = new FileAsset(Path.Combine(siteDir, Path.GetFileName(file))),
                Acl         = "public-read",
                ContentType = "text/html",
            });
        }
    }
コード例 #12
0
 public MyStack()
 {
     var test = new Aws.S3.Bucket("test", new Aws.S3.BucketArgs
     {
     });
     var inventory = new Aws.S3.Bucket("inventory", new Aws.S3.BucketArgs
     {
     });
     var test_prefix = new Aws.S3.Inventory("test-prefix", new Aws.S3.InventoryArgs
     {
         Bucket      = test.Id,
         Destination = new Aws.S3.Inputs.InventoryDestinationArgs
         {
             Bucket = new Aws.S3.Inputs.InventoryDestinationBucketArgs
             {
                 BucketArn = inventory.Arn,
                 Format    = "ORC",
                 Prefix    = "inventory",
             },
         },
         Filter = new Aws.S3.Inputs.InventoryFilterArgs
         {
             Prefix = "documents/",
         },
         IncludedObjectVersions = "All",
         Schedule = new Aws.S3.Inputs.InventoryScheduleArgs
         {
             Frequency = "Daily",
         },
     });
 }
コード例 #13
0
 public MyStack()
 {
     var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
     {
     });
     var topic = new Aws.Sns.Topic("topic", new Aws.Sns.TopicArgs
     {
         Policy = bucket.Arn.Apply(arn => @$ "{{
 " "Version" ":" "2012-10-17" ",
 " "Statement" ":[{{
コード例 #14
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var exampleBucket = new Aws.S3.Bucket("exampleBucket", new Aws.S3.BucketArgs
     {
     });
     var exampleAccessPoint = new Aws.S3.AccessPoint("exampleAccessPoint", new Aws.S3.AccessPointArgs
     {
         Bucket = exampleBucket.Id,
     });
 }
コード例 #15
0
   public MyStack()
   {
       var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
       {
       });
       var queue = new Aws.Sqs.Queue("queue", new Aws.Sqs.QueueArgs
       {
           Policy = bucket.Arn.Apply(arn => @$ "{{
 " "Version" ": " "2012-10-17" ",
 " "Statement" ": [
コード例 #16
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var example = new Aws.S3.Bucket("example", new Aws.S3.BucketArgs
     {
     });
     var example_entire_bucket = new Aws.S3.BucketMetric("example-entire-bucket", new Aws.S3.BucketMetricArgs
     {
         Bucket = example.BucketName,
     });
 }
コード例 #17
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
    public MyStack()
    {
        var fooRecorderStatus = new Aws.Cfg.RecorderStatus("fooRecorderStatus", new Aws.Cfg.RecorderStatusArgs
        {
            IsEnabled = true,
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                "aws_config_delivery_channel.foo",
            },
        });
        var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""config.amazonaws.com""
      },
      ""Effect"": ""Allow"",
      ""Sid"": """"
    }
  ]
}

",
        });
        var rolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("rolePolicyAttachment", new Aws.Iam.RolePolicyAttachmentArgs
        {
            PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSConfigRole",
            Role      = role.Name,
        });
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
        });
        var fooDeliveryChannel = new Aws.Cfg.DeliveryChannel("fooDeliveryChannel", new Aws.Cfg.DeliveryChannelArgs
        {
            S3BucketName = bucket.BucketName,
        });
        var fooRecorder = new Aws.Cfg.Recorder("fooRecorder", new Aws.Cfg.RecorderArgs
        {
            RoleArn = role.Arn,
        });
        var rolePolicy = new Aws.Iam.RolePolicy("rolePolicy", new Aws.Iam.RolePolicyArgs
        {
            Policy = Output.Tuple(bucket.Arn, bucket.Arn).Apply(values =>
            {
                var bucketArn  = values.Item1;
                var bucketArn1 = values.Item2;
                return(@$ "{{
  " "Version" ": " "2012-10-17" ",
  " "Statement" ": [
コード例 #18
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var defaultBucket = new Aws.S3.Bucket("defaultBucket", new Aws.S3.BucketArgs
     {
     });
     var defaultSpotDatafeedSubscription = new Aws.Ec2.SpotDatafeedSubscription("defaultSpotDatafeedSubscription", new Aws.Ec2.SpotDatafeedSubscriptionArgs
     {
         Bucket = defaultBucket.BucketName,
         Prefix = "my_subdirectory",
     });
 }
コード例 #19
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var hogeBucket = new Aws.S3.Bucket("hogeBucket", new Aws.S3.BucketArgs
     {
     });
     var hogeDatabase = new Aws.Athena.Database("hogeDatabase", new Aws.Athena.DatabaseArgs
     {
         Bucket = hogeBucket.BucketName,
         Name   = "database_name",
     });
 }
コード例 #20
0
 public MyStack()
 {
     var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
     {
         Acl        = "private",
         Versioning = new Aws.S3.Inputs.BucketVersioningArgs
         {
             Enabled = true,
         },
     });
 }
コード例 #21
0
ファイル: aws-s3-folder.cs プロジェクト: t0yv0/pulumi
    public MyStack()
    {
        // Create a bucket and expose a website index document
        var siteBucket = new Aws.S3.Bucket("siteBucket", new Aws.S3.BucketArgs
        {
            Website = new Aws.S3.Inputs.BucketWebsiteArgs
            {
                IndexDocument = "index.html",
            },
        });
        var siteDir = "www";
        // For each file in the directory, create an S3 object stored in `siteBucket`
        var files = new List <Aws.S3.BucketObject>();

        foreach (var range in Directory.GetFiles(siteDir).Select(Path.GetFileName).Select((v, k) => new { Key = k, Value = v }))
        {
            files.Add(new Aws.S3.BucketObject($"files-{range.Key}", new Aws.S3.BucketObjectArgs
            {
                Bucket      = siteBucket.Id,
                Key         = range.Value,
                Source      = new FileAsset($"{siteDir}/{range.Value}"),
                ContentType = range.Value,
            }));
        }
        // set the MIME type of the file
        // Set the access policy for the bucket so all objects are readable
        var bucketPolicy = new Aws.S3.BucketPolicy("bucketPolicy", new Aws.S3.BucketPolicyArgs
        {
            Bucket = siteBucket.Id,
            Policy = siteBucket.Id.Apply(id => JsonSerializer.Serialize(new Dictionary <string, object?>
            {
                { "Version", "2012-10-17" },
                { "Statement", new[]
                  {
                      new Dictionary <string, object?>
                      {
                          { "Effect", "Allow" },
                          { "Principal", "*" },
                          { "Action", new[]
                            {
                                "s3:GetObject",
                            } },
                          { "Resource", new[]
                            {
                                $"arn:aws:s3:::{id}/*",
                            } },
                      },
                  } },
            })),
        });

        this.BucketName = siteBucket.BucketName;
        this.WebsiteUrl = siteBucket.WebsiteEndpoint;
    }
コード例 #22
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var exampleBucket = new Aws.S3.Bucket("exampleBucket", new Aws.S3.BucketArgs
     {
     });
     var exampleBucketPublicAccessBlock = new Aws.S3.BucketPublicAccessBlock("exampleBucketPublicAccessBlock", new Aws.S3.BucketPublicAccessBlockArgs
     {
         BlockPublicAcls   = true,
         BlockPublicPolicy = true,
         Bucket            = exampleBucket.Id,
     });
 }
コード例 #23
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
         Tags = 
         {
             { "Environment", "Dev" },
             { "Name", "My bucket" },
         },
     });
 }
コード例 #24
0
 public MyStack()
 {
     var exampleBucket = new Aws.S3.Bucket("exampleBucket", new Aws.S3.BucketArgs
     {
     });
     var exampleFlowLog = new Aws.Ec2.FlowLog("exampleFlowLog", new Aws.Ec2.FlowLogArgs
     {
         LogDestination     = exampleBucket.Arn,
         LogDestinationType = "s3",
         TrafficType        = "ALL",
         VpcId = aws_vpc.Example.Id,
     });
 }
コード例 #25
0
    public MyStack()
    {
        var bucket = new Aws.S3.Bucket("my-bucket", new BucketArgs());

        this.BucketName = bucket.BucketName;

        var bucketFile   = Path.Combine("site", "index.html");
        var bucketObject = new Aws.S3.BucketObject("index.html", new BucketObjectArgs
        {
            Bucket = bucket.BucketName,
            Source = new FileAsset(bucketFile)
        });
    }
コード例 #26
0
ファイル: assets-archives.cs プロジェクト: t0yv0/pulumi
 public MyStack()
 {
     var siteBucket = new Aws.S3.Bucket("siteBucket", new Aws.S3.BucketArgs
     {
     });
     var testFileAsset = new Aws.S3.BucketObject("testFileAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new FileAsset("file.txt"),
     });
     var testStringAsset = new Aws.S3.BucketObject("testStringAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new StringAsset("<h1>File contents</h1>"),
     });
     var testRemoteAsset = new Aws.S3.BucketObject("testRemoteAsset", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new RemoteAsset("https://pulumi.test"),
     });
     var testFileArchive = new Aws.S3.BucketObject("testFileArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new FileArchive("file.tar.gz"),
     });
     var testRemoteArchive = new Aws.S3.BucketObject("testRemoteArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new RemoteArchive("https://pulumi.test/foo.tar.gz"),
     });
     var testAssetArchive = new Aws.S3.BucketObject("testAssetArchive", new Aws.S3.BucketObjectArgs
     {
         Bucket = siteBucket.Id,
         Source = new AssetArchive(new Dictionary <string, AssetOrArchive>
         {
             { "file.txt", new FileAsset("file.txt") },
             { "string.txt", new StringAsset("<h1>File contents</h1>") },
             { "remote.txt", new RemoteAsset("https://pulumi.test") },
             { "file.tar", new FileArchive("file.tar.gz") },
             { "remote.tar", new RemoteArchive("https://pulumi.test/foo.tar.gz") },
             { ".nestedDir", new AssetArchive(new Dictionary <string, AssetOrArchive>
                 {
                     { "file.txt", new FileAsset("file.txt") },
                     { "string.txt", new StringAsset("<h1>File contents</h1>") },
                     { "remote.txt", new RemoteAsset("https://pulumi.test") },
                     { "file.tar", new FileArchive("file.tar.gz") },
                     { "remote.tar", new RemoteArchive("https://pulumi.test/foo.tar.gz") },
                 }) },
         }),
     });
 }
コード例 #27
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
 public MyStack()
 {
     var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
     {
         Acl = "private",
     });
     var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
     {
         Bucket = examplebucket.Id,
         Key    = "someobject",
         ServerSideEncryption = "AES256",
         Source = new FileAsset("index.html"),
     });
 }
コード例 #28
0
ファイル: MyStack.cs プロジェクト: justinvp/templates-aws
    public MyStack()
    {
        var hogeBucket = new Aws.S3.Bucket("hogeBucket", new Aws.S3.BucketArgs
        {
            Region = "us-east-1",
        });
        var hogeBucketPolicy = new Aws.S3.BucketPolicy("hogeBucketPolicy", new Aws.S3.BucketPolicyArgs
        {
            Bucket = hogeBucket.BucketName,
            Policy = @"{
    ""Version"": ""2012-10-17"",
    ""Statement"": [
        {
            ""Sid"": ""SSMBucketPermissionsCheck"",
            ""Effect"": ""Allow"",
            ""Principal"": {
                ""Service"": ""ssm.amazonaws.com""
            },
            ""Action"": ""s3:GetBucketAcl"",
            ""Resource"": ""arn:aws:s3:::tf-test-bucket-1234""
        },
        {
            ""Sid"": "" SSMBucketDelivery"",
            ""Effect"": ""Allow"",
            ""Principal"": {
                ""Service"": ""ssm.amazonaws.com""
            },
            ""Action"": ""s3:PutObject"",
            ""Resource"": [""arn:aws:s3:::tf-test-bucket-1234/*""],
            ""Condition"": {
                ""StringEquals"": {
                    ""s3:x-amz-acl"": ""bucket-owner-full-control""
                }
            }
        }
    ]
}

",
        });
        var foo = new Aws.Ssm.ResourceDataSync("foo", new Aws.Ssm.ResourceDataSyncArgs
        {
            S3Destination = new Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs
            {
                BucketName = hogeBucket.BucketName,
                Region     = hogeBucket.Region,
            },
        });
    }
コード例 #29
0
    public MyStack()
    {
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
            ForceDestroy = true,
        });
        var fooDeliveryChannel = new Aws.Cfg.DeliveryChannel("fooDeliveryChannel", new Aws.Cfg.DeliveryChannelArgs
        {
            S3BucketName = bucket.BucketName,
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                "aws_config_configuration_recorder.foo",
            },
        });
        var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""config.amazonaws.com""
      },
      ""Effect"": ""Allow"",
      ""Sid"": """"
    }
  ]
}

",
        });
        var fooRecorder = new Aws.Cfg.Recorder("fooRecorder", new Aws.Cfg.RecorderArgs
        {
            RoleArn = role.Arn,
        });
        var rolePolicy = new Aws.Iam.RolePolicy("rolePolicy", new Aws.Iam.RolePolicyArgs
        {
            Policy = Output.Tuple(bucket.Arn, bucket.Arn).Apply(values =>
            {
                var bucketArn  = values.Item1;
                var bucketArn1 = values.Item2;
                return(@$ "{{
  " "Version" ": " "2012-10-17" ",
  " "Statement" ": [
コード例 #30
0
    public MyStack()
    {
        var logs = new Aws.S3.Bucket("logs", new Aws.S3.BucketArgs
        {
        });
        var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
        {
            Loggings =
            {
                new Aws.S3.Inputs.BucketLoggingArgs
                {
                    TargetBucket = logs.BucketName,
                },
            },
        });

        this.TargetBucket = bucket.Loggings.Apply(loggings => loggings[0].TargetBucket);
    }