BucketLoggingV2Args

data class BucketLoggingV2Args(val bucket: Output<String>? = null, val expectedBucketOwner: Output<String>? = null, val targetBucket: Output<String>? = null, val targetGrants: Output<List<BucketLoggingV2TargetGrantArgs>>? = null, val targetPrefix: Output<String>? = null) : ConvertibleToJava<BucketLoggingV2Args>

Provides an S3 bucket (server access) logging resource. For more information, see Logging requests using server access logging in the AWS S3 User Guide.

Note: Amazon S3 supports server access logging, AWS CloudTrail, or a combination of both. Refer to the Logging options for Amazon S3 to decide which method meets your requirements.

Example Usage

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.s3.BucketAclV2;
import com.pulumi.aws.s3.BucketAclV2Args;
import com.pulumi.aws.s3.BucketLoggingV2;
import com.pulumi.aws.s3.BucketLoggingV2Args;
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 exampleBucketV2 = new BucketV2("exampleBucketV2");
var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
.bucket(exampleBucketV2.id())
.acl("private")
.build());
var logBucket = new BucketV2("logBucket");
var logBucketAcl = new BucketAclV2("logBucketAcl", BucketAclV2Args.builder()
.bucket(logBucket.id())
.acl("log-delivery-write")
.build());
var exampleBucketLoggingV2 = new BucketLoggingV2("exampleBucketLoggingV2", BucketLoggingV2Args.builder()
.bucket(exampleBucketV2.id())
.targetBucket(logBucket.id())
.targetPrefix("log/")
.build());
}
}

Import

S3 bucket logging can be imported in one of two ways. If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, the S3 bucket logging resource should be imported using the bucket e.g.,

$ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 example bucket-name

If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, the S3 bucket logging resource should be imported using the bucket and expected_bucket_owner separated by a comma (,) e.g.,

$ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 example bucket-name,123456789012

Constructors

Link copied to clipboard
constructor(bucket: Output<String>? = null, expectedBucketOwner: Output<String>? = null, targetBucket: Output<String>? = null, targetGrants: Output<List<BucketLoggingV2TargetGrantArgs>>? = null, targetPrefix: Output<String>? = null)

Properties

Link copied to clipboard
val bucket: Output<String>? = null

Name of the bucket.

Link copied to clipboard
val expectedBucketOwner: Output<String>? = null

Account ID of the expected bucket owner.

Link copied to clipboard
val targetBucket: Output<String>? = null

Name of the bucket where you want Amazon S3 to store server access logs.

Link copied to clipboard

Set of configuration blocks with information for granting permissions. See below.

Link copied to clipboard
val targetPrefix: Output<String>? = null

Prefix for all log object keys.

Functions

Link copied to clipboard
open override fun toJava(): BucketLoggingV2Args