Class BucketV2


  • public class BucketV2
    extends com.pulumi.resources.CustomResource
    Provides a S3 bucket resource. > This resource provides functionality for managing S3 general purpose buckets in an AWS Partition. To manage Amazon S3 Express directory buckets, use the `aws_directory_bucket` resource. To manage [S3 on Outposts](https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html), use the `aws.s3control.Bucket` resource. > Object Lock can be enabled by using the `object_lock_enable` attribute or by using the `aws.s3.BucketObjectLockConfigurationV2` resource. Please note, that by using the resource, Object Lock can be enabled/disabled without destroying and recreating the bucket. ## Example Usage ### Private Bucket With Tags <!--Start PulumiCodeChooser --> ```java 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.BucketV2Args; 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 BucketV2("example", BucketV2Args.builder() .bucket("my-tf-test-bucket") .tags(Map.ofEntries( Map.entry("Name", "My bucket"), Map.entry("Environment", "Dev") )) .build()); } } ``` <!--End PulumiCodeChooser --> ## Import Using `pulumi import`, import S3 bucket using the `bucket`. For example: ```sh $ pulumi import aws:s3/bucketV2:BucketV2 bucket bucket-name ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      BucketV2​(java.lang.String name)  
      BucketV2​(java.lang.String name, BucketV2Args args)  
      BucketV2​(java.lang.String name, BucketV2Args args, com.pulumi.resources.CustomResourceOptions options)  
    • Constructor Detail

      • BucketV2

        public BucketV2​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • BucketV2

        public BucketV2​(java.lang.String name,
                        @Nullable
                        BucketV2Args args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • BucketV2

        public BucketV2​(java.lang.String name,
                        @Nullable
                        BucketV2Args args,
                        @Nullable
                        com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • accelerationStatus

        public com.pulumi.core.Output<java.lang.String> accelerationStatus()
        Returns:
        Sets the accelerate configuration of an existing bucket. Can be `Enabled` or `Suspended`. Cannot be used in `cn-north-1` or `us-gov-west-1`. This provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketAccelerateConfigurationV2` instead.
      • acl

        public com.pulumi.core.Output<java.lang.String> acl()
        Returns:
        The [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply. Valid values are `private`, `public-read`, `public-read-write`, `aws-exec-read`, `authenticated-read`, and `log-delivery-write`. Defaults to `private`. Conflicts with `grant`. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketAclV2` instead.
      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the bucket. Will be of format `arn:aws:s3:::bucketname`.
      • bucket

        public com.pulumi.core.Output<java.lang.String> bucket()
        Returns:
        Name of the bucket. If omitted, the provider will assign a random, unique name. Must be lowercase and less than or equal to 63 characters in length. A full list of bucket naming rules [may be found here](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html). The name must not be in the format `[bucket_name]--[azid]--x-s3`. Use the `aws.s3.DirectoryBucket` resource to manage S3 Express buckets.
      • bucketDomainName

        public com.pulumi.core.Output<java.lang.String> bucketDomainName()
        Returns:
        Bucket domain name. Will be of format `bucketname.s3.amazonaws.com`.
      • bucketPrefix

        public com.pulumi.core.Output<java.lang.String> bucketPrefix()
        Returns:
        Creates a unique bucket name beginning with the specified prefix. Conflicts with `bucket`. Must be lowercase and less than or equal to 37 characters in length. A full list of bucket naming rules [may be found here](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html).
      • bucketRegionalDomainName

        public com.pulumi.core.Output<java.lang.String> bucketRegionalDomainName()
        Returns:
        The bucket region-specific domain name. The bucket domain name including the region name. Please refer to the [S3 endpoints reference](https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_region) for format. Note: AWS CloudFront allows specifying an S3 region-specific endpoint when creating an S3 origin. This will prevent redirect issues from CloudFront to the S3 Origin URL. For more information, see the [Virtual Hosted-Style Requests for Other Regions](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#deprecated-global-endpoint) section in the AWS S3 User Guide.
      • corsRules

        public com.pulumi.core.Output<java.util.List<BucketV2CorsRule>> corsRules()
        Returns:
        Rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html). See CORS rule below for details. This provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketCorsConfigurationV2` instead.
      • forceDestroy

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> forceDestroy()
        Returns:
        Boolean that indicates all objects (including any [locked objects](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html)) should be deleted from the bucket *when the bucket is destroyed* so that the bucket can be destroyed without error. These objects are *not* recoverable. This only deletes objects when the bucket is destroyed, *not* when setting this parameter to `true`. Once this parameter is set to `true`, there must be a successful `pulumi up` run before a destroy is required to update this value in the resource state. Without a successful `pulumi up` after this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the bucket or destroying the bucket, this flag will not work. Additionally when importing a bucket, a successful `pulumi up` is required to set this value in state before it will take effect on a destroy operation.
      • grants

        public com.pulumi.core.Output<java.util.List<BucketV2Grant>> grants()
        Returns:
        An [ACL policy grant](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#sample-acl). See Grant below for details. Conflicts with `acl`. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketAclV2` instead.
      • hostedZoneId

        public com.pulumi.core.Output<java.lang.String> hostedZoneId()
        Returns:
        [Route 53 Hosted Zone ID](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints) for this bucket's region.
      • lifecycleRules

        public com.pulumi.core.Output<java.util.List<BucketV2LifecycleRule>> lifecycleRules()
        Returns:
        Configuration of [object lifecycle management](http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html). See Lifecycle Rule below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketLifecycleConfigurationV2` instead.
      • loggings

        public com.pulumi.core.Output<java.util.List<BucketV2Logging>> loggings()
        Returns:
        Configuration of [S3 bucket logging](https://docs.aws.amazon.com/AmazonS3/latest/UG/ManagingBucketLogging.html) parameters. See Logging below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketLoggingV2` instead.
      • objectLockConfiguration

        public com.pulumi.core.Output<BucketV2ObjectLockConfiguration> objectLockConfiguration()
        Returns:
        Configuration of [S3 object locking](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). See Object Lock Configuration below for details. The provider wil only perform drift detection if a configuration value is provided. Use the `object_lock_enabled` parameter and the resource `aws.s3.BucketObjectLockConfigurationV2` instead.
      • objectLockEnabled

        public com.pulumi.core.Output<java.lang.Boolean> objectLockEnabled()
        Returns:
        Indicates whether this bucket has an Object Lock configuration enabled. Valid values are `true` or `false`. This argument is not supported in all regions or partitions.
      • policy

        public com.pulumi.core.Output<java.lang.String> policy()
        Returns:
        Valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html) JSON document. Note that if the policy document is not specific enough (but still valid), this provider may view the policy as constantly changing. In this case, please make sure you use the verbose/specific version of the policy. For more information about building AWS IAM policy documents with this provider, see the AWS IAM Policy Document Guide. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketPolicy` instead.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        AWS region this bucket resides in.
      • replicationConfigurations

        public com.pulumi.core.Output<java.util.List<BucketV2ReplicationConfiguration>> replicationConfigurations()
        Returns:
        Configuration of [replication configuration](http://docs.aws.amazon.com/AmazonS3/latest/dev/crr.html). See Replication Configuration below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketReplicationConfig` instead.
      • requestPayer

        public com.pulumi.core.Output<java.lang.String> requestPayer()
        Returns:
        Specifies who should bear the cost of Amazon S3 data transfer. Can be either `BucketOwner` or `Requester`. By default, the owner of the S3 bucket would incur the costs of any data transfer. See [Requester Pays Buckets](http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html) developer guide for more information. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketRequestPaymentConfigurationV2` instead.
      • serverSideEncryptionConfigurations

        public com.pulumi.core.Output<java.util.List<BucketV2ServerSideEncryptionConfiguration>> serverSideEncryptionConfigurations()
        Returns:
        Configuration of [server-side encryption configuration](http://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html). See Server Side Encryption Configuration below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketServerSideEncryptionConfigurationV2` instead.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the bucket. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. The following arguments are deprecated, and will be removed in a future major version:
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
      • versionings

        public com.pulumi.core.Output<java.util.List<BucketV2Versioning>> versionings()
        Returns:
        Configuration of the [S3 bucket versioning state](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html). See Versioning below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketVersioningV2` instead.
      • websiteDomain

        public com.pulumi.core.Output<java.lang.String> websiteDomain()
        Returns:
        (**Deprecated**) Domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records. Use the resource `aws.s3.BucketWebsiteConfigurationV2` instead.
      • websiteEndpoint

        public com.pulumi.core.Output<java.lang.String> websiteEndpoint()
        Returns:
        (**Deprecated**) Website endpoint, if the bucket is configured with a website. If not, this will be an empty string. Use the resource `aws.s3.BucketWebsiteConfigurationV2` instead.
      • websites

        public com.pulumi.core.Output<java.util.List<BucketV2Website>> websites()
        Returns:
        Configuration of the [S3 bucket website](https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteHosting.html). See Website below for details. The provider will only perform drift detection if a configuration value is provided. Use the resource `aws.s3.BucketWebsiteConfigurationV2` instead.
      • get

        public static BucketV2 get​(java.lang.String name,
                                   com.pulumi.core.Output<java.lang.String> id,
                                   @Nullable
                                   BucketV2State state,
                                   @Nullable
                                   com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.