layout: "huaweicloud" page_title: ""HuaweiCloud: huaweicloud_s3_bucket_object" sidebar_current: "docs-huaweicloud-resource-s3-bucket-object" description: |-

» Provides a S3 bucket object resource.

» huaweicloud_s3_bucket_object

Provides a S3 bucket object resource.

» Example Usage

» Uploading a file to a bucket

resource "huaweicloud_s3_bucket_object" "object" {
  bucket = "your_bucket_name"
  key    = "new_object_key"
  source = "path/to/file"
  etag   = "${md5(file("path/to/file"))}"
}

resource "huaweicloud_s3_bucket" "examplebucket" { bucket = "examplebuckettftest" acl = "private" }

resource "huaweicloud_s3_bucket_object" "examplebucket_object" { key = "someobject" bucket = "${huaweicloud_s3_bucket.examplebucket.bucket}" source = "index.html" } ```

» Server Side Encryption with S3 Default Master Key

resource "huaweicloud_s3_bucket" "examplebucket" {
  bucket = "examplebuckettftest"
  acl    = "private"
}

resource "huaweicloud_s3_bucket_object" "examplebucket_object" {
  key                    = "someobject"
  bucket                 = "${huaweicloud_s3_bucket.examplebucket.bucket}"
  source                 = "index.html"
  server_side_encryption = "aws:kms"
}

» Argument Reference

The following arguments are supported:

Either source or content must be provided to specify the bucket content. These two arguments are mutually-exclusive.

» Attributes Reference

The following attributes are exported