Skip to content
v2.278.0

CfnBucketProps Struct ​

Properties for defining a CfnBucket.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cfnBucketProps: lightsail.CfnBucketProps = {
  bucketName: 'bucketName',
  bundleId: 'bundleId',

  // the properties below are optional
  accessRules: {
    allowPublicOverrides: false,
    objectAccess: 'objectAccess',
  },
  objectVersioning: false,
  readOnlyAccessAccounts: ['readOnlyAccessAccounts'],
  resourcesReceivingAccess: ['resourcesReceivingAccess'],
  tags: [{
    key: 'key',
    value: 'value',
  }],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_lightsail as lightsail

cfn_bucket_props = lightsail.CfnBucketProps(
    bucket_name="bucketName",
    bundle_id="bundleId",

    # the properties below are optional
    access_rules=lightsail.CfnBucket.AccessRulesProperty(
        allow_public_overrides=False,
        object_access="objectAccess"
    ),
    object_versioning=False,
    read_only_access_accounts=["readOnlyAccessAccounts"],
    resources_receiving_access=["resourcesReceivingAccess"],
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.lightsail.*;

CfnBucketProps cfnBucketProps = CfnBucketProps.builder()
        .bucketName("bucketName")
        .bundleId("bundleId")

        // the properties below are optional
        .accessRules(AccessRulesProperty.builder()
                .allowPublicOverrides(false)
                .objectAccess("objectAccess")
                .build())
        .objectVersioning(false)
        .readOnlyAccessAccounts(List.of("readOnlyAccessAccounts"))
        .resourcesReceivingAccess(List.of("resourcesReceivingAccess"))
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Lightsail;

var cfnBucketProps = new CfnBucketProps {
    BucketName = "bucketName",
    BundleId = "bundleId",

    // the properties below are optional
    AccessRules = new AccessRulesProperty {
        AllowPublicOverrides = false,
        ObjectAccess = "objectAccess"
    },
    ObjectVersioning = false,
    ReadOnlyAccessAccounts = new [] { "readOnlyAccessAccounts" },
    ResourcesReceivingAccess = new [] { "resourcesReceivingAccess" },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnBucketProps := &CfnBucketProps{
	BucketName: jsii.String("bucketName"),
	BundleId: jsii.String("bundleId"),

	// the properties below are optional
	AccessRules: &AccessRulesProperty{
		AllowPublicOverrides: jsii.Boolean(false),
		ObjectAccess: jsii.String("objectAccess"),
	},
	ObjectVersioning: jsii.Boolean(false),
	ReadOnlyAccessAccounts: []*string{
		jsii.String("readOnlyAccessAccounts"),
	},
	ResourcesReceivingAccess: []*string{
		jsii.String("resourcesReceivingAccess"),
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
}

Properties ​

accessRulesoptionalIResolvable | CfnBucket.AccessRulesPropertyaccess_rulesoptionaltyping.Union[IResolvable, AccessRulesProperty]accessRulesoptionalIResolvableAccessRulesoptionalIResolvableAccessRulesoptionalinterface{} #
An object that describes the access rules for the bucket.
bucketNamestringbucket_namestrbucketNameStringBucketNamestringBucketName*string required #
The name of the bucket.
bundleIdstringbundle_idstrbundleIdStringBundleIdstringBundleId*string required #
The bundle ID for the bucket (for example, `small_1_0` ).

A bucket bundle specifies the monthly cost, storage space, and data transfer quota for a bucket.

objectVersioningoptionalboolean | IResolvableobject_versioningoptionaltyping.Union[bool, IResolvable]objectVersioningoptionalBooleanObjectVersioningoptionalboolObjectVersioningoptionalinterface{} #
Indicates whether object versioning is enabled for the bucket.
notes

The following options can be configured:

  • Enabled - Object versioning is enabled.
  • Suspended - Object versioning was previously enabled but is currently suspended. Existing object versions are retained.
  • NeverEnabled - Object versioning has never been enabled.
readOnlyAccessAccountsoptionalstring[]read_only_access_accountsoptionaltyping.List[str]readOnlyAccessAccountsoptionalList<String>ReadOnlyAccessAccountsoptionalstring[]ReadOnlyAccessAccountsoptional*[]*string #
An array of AWS account IDs that have read-only access to the bucket.
resourcesReceivingAccessoptionalstring[]resources_receiving_accessoptionaltyping.List[str]resourcesReceivingAccessoptionalList<String>ResourcesReceivingAccessoptionalstring[]ResourcesReceivingAccessoptional*[]*string #
An array of Lightsail instances that have access to the bucket.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag #
An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide .

The Value of Tags is optional for Lightsail resources.