Skip to main content

buckets

Creates, updates, deletes or gets a bucket resource or lists buckets in a region

Overview

Namebuckets
TypeResource
DescriptionResource Type definition for AWS::Lightsail::Bucket
Idawscc.lightsail.buckets

Fields

NameDatatypeDescription
bucket_namestringThe name for the bucket.
bundle_idstringThe ID of the bundle to use for the bucket.
bucket_arnstring
object_versioningbooleanSpecifies whether to enable or disable versioning of objects in the bucket.
access_rulesobjectAn object that sets the public accessibility of objects in the specified bucket.
resources_receiving_accessarrayThe names of the Lightsail resources for which to set bucket access.
read_only_access_accountsarrayAn array of strings to specify the AWS account IDs that can access the bucket.
tagsarrayAn array of key-value pairs to apply to this resource.
urlstringThe URL of the bucket.
able_to_update_bundlebooleanIndicates whether the bundle that is currently applied to a bucket can be changed to another bundle. You can update a bucket's bundle only one time within a monthly AWS billing cycle.
regionstringAWS region.

For more information, see AWS::Lightsail::Bucket.

Methods

NameResourceAccessible byRequired Params
create_resourcebucketsINSERTBucketName, BundleId, region
delete_resourcebucketsDELETEIdentifier, region
update_resourcebucketsUPDATEIdentifier, PatchDocument, region
list_resourcesbuckets_list_onlySELECTregion
get_resourcebucketsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual bucket.

SELECT
region,
bucket_name,
bundle_id,
bucket_arn,
object_versioning,
access_rules,
resources_receiving_access,
read_only_access_accounts,
tags,
url,
able_to_update_bundle
FROM awscc.lightsail.buckets
WHERE
region = '{{ region }}' AND
Identifier = '{{ bucket_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new bucket resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.lightsail.buckets (
BucketName,
BundleId,
region
)
SELECT
'{{ bucket_name }}',
'{{ bundle_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a bucket resource, using stack-deploy.

/*+ update */
UPDATE awscc.lightsail.buckets
SET PatchDocument = string('{{ {
"BundleId": bundle_id,
"ObjectVersioning": object_versioning,
"AccessRules": access_rules,
"ResourcesReceivingAccess": resources_receiving_access,
"ReadOnlyAccessAccounts": read_only_access_accounts,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ bucket_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.lightsail.buckets
WHERE
Identifier = '{{ bucket_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the buckets resource, the following permissions are required:

lightsail:CreateBucket,
lightsail:GetBuckets,
lightsail:GetInstance,
lightsail:UpdateBucket,
lightsail:UpdateBucketBundle,
lightsail:SetResourceAccessForBucket,
lightsail:TagResource,
lightsail:UntagResource