buckets
Creates, updates, deletes or gets a bucket resource or lists buckets in a region
Overview
| Name | buckets |
| Type | Resource |
| Description | Resource Type definition for AWS::Lightsail::Bucket |
| Id | awscc.lightsail.buckets |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
bucket_name | string | The name for the bucket. |
bundle_id | string | The ID of the bundle to use for the bucket. |
bucket_arn | string | |
object_versioning | boolean | Specifies whether to enable or disable versioning of objects in the bucket. |
access_rules | object | An object that sets the public accessibility of objects in the specified bucket. |
resources_receiving_access | array | The names of the Lightsail resources for which to set bucket access. |
read_only_access_accounts | array | An array of strings to specify the AWS account IDs that can access the bucket. |
tags | array | An array of key-value pairs to apply to this resource. |
url | string | The URL of the bucket. |
able_to_update_bundle | boolean | Indicates 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. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
bucket_name | string | The name for the bucket. |
region | string | AWS region. |
For more information, see AWS::Lightsail::Bucket.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | buckets | INSERT | BucketName, BundleId, region |
delete_resource | buckets | DELETE | Identifier, region |
update_resource | buckets | UPDATE | Identifier, PatchDocument, region |
list_resources | buckets_list_only | SELECT | region |
get_resource | buckets | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ bucket_name }}';
Lists all buckets in a region.
SELECT
region,
bucket_name
FROM awscc.lightsail.buckets_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new bucket resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.lightsail.buckets (
BucketName,
BundleId,
region
)
SELECT
'{{ bucket_name }}',
'{{ bundle_id }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.lightsail.buckets (
BucketName,
BundleId,
ObjectVersioning,
AccessRules,
ResourcesReceivingAccess,
ReadOnlyAccessAccounts,
Tags,
region
)
SELECT
'{{ bucket_name }}',
'{{ bundle_id }}',
'{{ object_versioning }}',
'{{ access_rules }}',
'{{ resources_receiving_access }}',
'{{ read_only_access_accounts }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: bucket
props:
- name: bucket_name
value: '{{ bucket_name }}'
- name: bundle_id
value: '{{ bundle_id }}'
- name: object_versioning
value: '{{ object_versioning }}'
- name: access_rules
value:
get_object: '{{ get_object }}'
allow_public_overrides: '{{ allow_public_overrides }}'
- name: resources_receiving_access
value:
- '{{ resources_receiving_access[0] }}'
- name: read_only_access_accounts
value:
- '{{ read_only_access_accounts[0] }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.lightsail.buckets
WHERE
Identifier = '{{ bucket_name }}' AND
region = 'us-east-1';
Permissions
To operate on the buckets resource, the following permissions are required:
- Create
- Read
- Delete
- List
- Update
lightsail:CreateBucket,
lightsail:GetBuckets,
lightsail:GetInstance,
lightsail:UpdateBucket,
lightsail:UpdateBucketBundle,
lightsail:SetResourceAccessForBucket,
lightsail:TagResource,
lightsail:UntagResource
lightsail:GetBuckets
lightsail:DeleteBucket,
lightsail:GetBuckets
lightsail:GetBuckets
lightsail:GetBuckets,
lightsail:GetInstance,
lightsail:UpdateBucket,
lightsail:UpdateBucketBundle,
lightsail:SetResourceAccessForBucket,
lightsail:TagResource,
lightsail:UntagResource