Expand description
Provides an S3 object resource.
§Example Usage
§Uploading a file to a bucket
resources:
object:
type: aws:s3:BucketObject
properties:
bucket: your_bucket_name
key: new_object_key
source:
fn::FileAsset: path/to/file
etag:
fn::invoke:
function: std:filemd5
arguments:
input: path/to/file
return: result
§Encrypting with KMS Key
resources:
examplekms:
type: aws:kms:Key
properties:
description: KMS key 1
deletionWindowInDays: 7
examplebucket:
type: aws:s3:BucketV2
properties:
bucket: examplebuckettftest
example:
type: aws:s3:BucketAclV2
properties:
bucket: ${examplebucket.id}
acl: private
exampleBucketObject:
type: aws:s3:BucketObject
name: example
properties:
key: someobject
bucket: ${examplebucket.id}
source:
fn::FileAsset: index.html
kmsKeyId: ${examplekms.arn}
§Server Side Encryption with S3 Default Master Key
resources:
examplebucket:
type: aws:s3:BucketV2
properties:
bucket: examplebuckettftest
example:
type: aws:s3:BucketAclV2
properties:
bucket: ${examplebucket.id}
acl: private
exampleBucketObject:
type: aws:s3:BucketObject
name: example
properties:
key: someobject
bucket: ${examplebucket.id}
source:
fn::FileAsset: index.html
serverSideEncryption: aws:kms
§Server Side Encryption with AWS-Managed Key
resources:
examplebucket:
type: aws:s3:BucketV2
properties:
bucket: examplebuckettftest
example:
type: aws:s3:BucketAclV2
properties:
bucket: ${examplebucket.id}
acl: private
exampleBucketObject:
type: aws:s3:BucketObject
name: example
properties:
key: someobject
bucket: ${examplebucket.id}
source:
fn::FileAsset: index.html
serverSideEncryption: AES256
§S3 Object Lock
resources:
examplebucket:
type: aws:s3:BucketV2
properties:
bucket: examplebuckettftest
objectLockEnabled: true
example:
type: aws:s3:BucketAclV2
properties:
bucket: ${examplebucket.id}
acl: private
exampleBucketVersioningV2:
type: aws:s3:BucketVersioningV2
name: example
properties:
bucket: ${examplebucket.id}
versioningConfiguration:
status: Enabled
exampleBucketObject:
type: aws:s3:BucketObject
name: example
properties:
key: someobject
bucket: ${examplebucket.id}
source:
fn::FileAsset: important.txt
objectLockLegalHoldStatus: ON
objectLockMode: GOVERNANCE
objectLockRetainUntilDate: 2021-12-31T23:59:60Z
forceDestroy: true
options:
dependsOn:
- ${exampleBucketVersioningV2}
§Import
Import using S3 URL syntax:
Using pulumi import
to import objects using the id
or S3 URL. For example:
Import using the id
, which is the bucket name and the key together:
$ pulumi import aws:s3/bucketObject:BucketObject example some-bucket-name/some/key.txt
Import using S3 URL syntax:
$ pulumi import aws:s3/bucketObject:BucketObject example s3://some-bucket-name/some/key.txt
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments