Class BucketObject
Provides a S3 bucket object resource.
Example Usage
Encrypting with KMS Key
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var examplekms = new Aws.Kms.Key("examplekms", new Aws.Kms.KeyArgs
{
DeletionWindowInDays = 7,
Description = "KMS key 1",
});
var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
{
Acl = "private",
});
var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
{
Bucket = examplebucket.Id,
Key = "someobject",
KmsKeyId = examplekms.Arn,
Source = new FileAsset("index.html"),
});
}
}
Server Side Encryption with S3 Default Master Key
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
{
Acl = "private",
});
var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
{
Bucket = examplebucket.Id,
Key = "someobject",
ServerSideEncryption = "aws:kms",
Source = new FileAsset("index.html"),
});
}
}
Server Side Encryption with AWS-Managed Key
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
{
Acl = "private",
});
var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
{
Bucket = examplebucket.Id,
Key = "someobject",
ServerSideEncryption = "AES256",
Source = new FileAsset("index.html"),
});
}
}
S3 Object Lock
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var examplebucket = new Aws.S3.Bucket("examplebucket", new Aws.S3.BucketArgs
{
Acl = "private",
ObjectLockConfiguration = new Aws.S3.Inputs.BucketObjectLockConfigurationArgs
{
ObjectLockEnabled = "Enabled",
},
Versioning = new Aws.S3.Inputs.BucketVersioningArgs
{
Enabled = true,
},
});
var examplebucketObject = new Aws.S3.BucketObject("examplebucketObject", new Aws.S3.BucketObjectArgs
{
Bucket = examplebucket.Id,
ForceDestroy = true,
Key = "someobject",
ObjectLockLegalHoldStatus = "ON",
ObjectLockMode = "GOVERNANCE",
ObjectLockRetainUntilDate = "2021-12-31T23:59:60Z",
Source = new FileAsset("important.txt"),
});
}
}
Inherited Members
Namespace: Pulumi.Aws.S3
Assembly: Pulumi.Aws.dll
Syntax
public class BucketObject : CustomResource
Constructors
View SourceBucketObject(String, BucketObjectArgs, CustomResourceOptions)
Create a BucketObject resource with the given unique name, arguments, and options.
Declaration
public BucketObject(string name, BucketObjectArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| BucketObjectArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAcl
The canned ACL to apply. Defaults to "private".
Declaration
public Output<string> Acl { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Bucket
The name of the bucket to put the file in. Alternatively, an S3 access point ARN can be specified.
Declaration
public Output<string> Bucket { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CacheControl
Specifies caching behavior along the request/reply chain Read w3c cache_control for further details.
Declaration
public Output<string> CacheControl { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Content
Literal string value to use as the object content, which will be uploaded as UTF-8-encoded text.
Declaration
public Output<string> Content { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ContentBase64
Base64-encoded data that will be decoded and uploaded as raw bytes for the object content. This allows safely uploading non-UTF8 binary data, but is recommended only for small content such as the result of the gzipbase64 function with small text strings. For larger objects, use source to stream the content from a disk file.
Declaration
public Output<string> ContentBase64 { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ContentDisposition
Specifies presentational information for the object. Read w3c content_disposition for further information.
Declaration
public Output<string> ContentDisposition { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ContentEncoding
Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. Read w3c content encoding for further information.
Declaration
public Output<string> ContentEncoding { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ContentLanguage
The language the content is in e.g. en-US or en-GB.
Declaration
public Output<string> ContentLanguage { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ContentType
A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input.
Declaration
public Output<string> ContentType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Etag
Used to trigger updates. The only meaningful value is ${filemd5("path/to/file")} (this provider 0.11.12 or later) or ${md5(file("path/to/file"))} (this provider 0.11.11 or earlier).
This attribute is not compatible with KMS encryption, kms_key_id or server_side_encryption = "aws:kms".
Declaration
public Output<string> Etag { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ForceDestroy
Allow the object to be deleted by removing any legal hold on any object version.
Default is false. This value should be set to true only if the bucket has S3 object lock enabled.
Declaration
public Output<bool?> ForceDestroy { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Key
The name of the object once it is in the bucket.
Declaration
public Output<string> Key { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
KmsKeyId
Specifies the AWS KMS Key ARN to use for object encryption.
This value is a fully qualified ARN of the KMS Key. If using aws.kms.Key,
use the exported arn attribute:
kms_key_id = "${aws_kms_key.foo.arn}"
Declaration
public Output<string> KmsKeyId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Metadata
A map of keys/values to provision metadata (will be automatically prefixed by x-amz-meta-, note that only lowercase label are currently supported by the AWS Go API).
Declaration
public Output<ImmutableDictionary<string, string>> Metadata { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
ObjectLockLegalHoldStatus
The legal hold status that you want to apply to the specified object. Valid values are ON and OFF.
Declaration
public Output<string> ObjectLockLegalHoldStatus { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ObjectLockMode
The object lock retention mode that you want to apply to this object. Valid values are GOVERNANCE and COMPLIANCE.
Declaration
public Output<string> ObjectLockMode { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ObjectLockRetainUntilDate
The date and time, in RFC3339 format, when this object's object lock will expire.
Declaration
public Output<string> ObjectLockRetainUntilDate { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ServerSideEncryption
Specifies server-side encryption of the object in S3. Valid values are "AES256" and "aws:kms".
Declaration
public Output<string> ServerSideEncryption { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Source
The path to a file that will be read and uploaded as raw bytes for the object content.
Declaration
public Output<AssetOrArchive> Source { get; }
Property Value
| Type | Description |
|---|---|
| Output<AssetOrArchive> |
StorageClass
Specifies the desired Storage Class
for the object. Can be either "STANDARD", "REDUCED_REDUNDANCY", "ONEZONE_IA", "INTELLIGENT_TIERING", "GLACIER", "DEEP_ARCHIVE", or "STANDARD_IA". Defaults to "STANDARD".
Declaration
public Output<string> StorageClass { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to assign to the object.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
VersionId
A unique version ID value for the object, if bucket versioning is enabled.
Declaration
public Output<string> VersionId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
WebsiteRedirect
Specifies a target URL for website redirect.
Declaration
public Output<string> WebsiteRedirect { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, BucketObjectState, CustomResourceOptions)
Get an existing BucketObject resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static BucketObject Get(string name, Input<string> id, BucketObjectState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| BucketObjectState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| BucketObject |