Inventory
Provides a S3 bucket inventory configuration resource.
Example Usage
Add inventory configuration
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.Inventory;
import com.pulumi.aws.s3.InventoryArgs;
import com.pulumi.aws.s3.inputs.InventoryScheduleArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationBucketArgs;
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 testBucketV2 = new BucketV2("testBucketV2");
var inventory = new BucketV2("inventory");
var testInventory = new Inventory("testInventory", InventoryArgs.builder()
.bucket(testBucketV2.id())
.includedObjectVersions("All")
.schedule(InventoryScheduleArgs.builder()
.frequency("Daily")
.build())
.destination(InventoryDestinationArgs.builder()
.bucket(InventoryDestinationBucketArgs.builder()
.format("ORC")
.bucketArn(inventory.arn())
.build())
.build())
.build());
}
}
Content copied to clipboard
Add inventory configuration with S3 object prefix
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.Inventory;
import com.pulumi.aws.s3.InventoryArgs;
import com.pulumi.aws.s3.inputs.InventoryScheduleArgs;
import com.pulumi.aws.s3.inputs.InventoryFilterArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationArgs;
import com.pulumi.aws.s3.inputs.InventoryDestinationBucketArgs;
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 test = new BucketV2("test");
var inventory = new BucketV2("inventory");
var test_prefix = new Inventory("test-prefix", InventoryArgs.builder()
.bucket(test.id())
.includedObjectVersions("All")
.schedule(InventoryScheduleArgs.builder()
.frequency("Daily")
.build())
.filter(InventoryFilterArgs.builder()
.prefix("documents/")
.build())
.destination(InventoryDestinationArgs.builder()
.bucket(InventoryDestinationBucketArgs.builder()
.format("ORC")
.bucketArn(inventory.arn())
.prefix("inventory")
.build())
.build())
.build());
}
}
Content copied to clipboard
Import
S3 bucket inventory configurations can be imported using bucket:inventory
, e.g.,
$ pulumi import aws:s3/inventory:Inventory my-bucket-entire-bucket my-bucket:EntireBucket
Content copied to clipboard
Properties
Link copied to clipboard
List of optional fields that are included in the inventory results. Please refer to the S3 documentation for more details.
Link copied to clipboard