storage_lens
Creates, updates, deletes or gets a storage_len resource or lists storage_lens in a region
Overview
| Name | storage_lens |
| Type | Resource |
| Description | The AWS::S3::StorageLens resource is an Amazon S3 resource type that you can use to create Storage Lens configurations. |
| Id | awscc.s3.storage_lens |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
storage_lens_configuration | object | Specifies the details of Amazon S3 Storage Lens configuration. |
tags | array | A set of tags (key-value pairs) for this Amazon S3 Storage Lens configuration. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
storage_lens_configuration | object | Specifies the details of Amazon S3 Storage Lens configuration. |
region | string | AWS region. |
For more information, see AWS::S3::StorageLens.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | storage_lens | INSERT | StorageLensConfiguration, region |
delete_resource | storage_lens | DELETE | Identifier, region |
update_resource | storage_lens | UPDATE | Identifier, PatchDocument, region |
list_resources | storage_lens_list_only | SELECT | region |
get_resource | storage_lens | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual storage_len.
SELECT
region,
storage_lens_configuration,
tags
FROM awscc.s3.storage_lens
WHERE
region = '{{ region }}' AND
Identifier = '{{ storage_lens_configuration/id }}';
Lists all storage_lens in a region.
SELECT
region,
storage_lens_configuration/id
FROM awscc.s3.storage_lens_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new storage_len resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.s3.storage_lens (
StorageLensConfiguration,
region
)
SELECT
'{{ storage_lens_configuration }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.s3.storage_lens (
StorageLensConfiguration,
Tags,
region
)
SELECT
'{{ storage_lens_configuration }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: storage_len
props:
- name: storage_lens_configuration
value:
account_level:
advanced_data_protection_metrics:
is_enabled: '{{ is_enabled }}'
storage_lens_group_level:
storage_lens_group_selection_criteria:
exclude:
- '{{ exclude[0] }}'
include:
- null
activity_metrics:
is_enabled: '{{ is_enabled }}'
bucket_level:
advanced_data_protection_metrics: null
prefix_level:
storage_metrics:
is_enabled: '{{ is_enabled }}'
selection_criteria:
delimiter: '{{ delimiter }}'
max_depth: '{{ max_depth }}'
min_storage_bytes_percentage: null
activity_metrics: null
advanced_cost_optimization_metrics:
is_enabled: '{{ is_enabled }}'
detailed_status_codes_metrics:
is_enabled: '{{ is_enabled }}'
advanced_cost_optimization_metrics: null
detailed_status_codes_metrics: null
exclude:
regions:
- '{{ regions[0] }}'
buckets:
- '{{ buckets[0] }}'
is_enabled: '{{ is_enabled }}'
include: null
aws_org:
arn: null
id: '{{ id }}'
storage_lens_arn: '{{ storage_lens_arn }}'
data_export:
s3_bucket_destination:
output_schema_version: '{{ output_schema_version }}'
format: '{{ format }}'
account_id: '{{ account_id }}'
prefix: '{{ prefix }}'
encryption: {}
arn: '{{ arn }}'
cloud_watch_metrics:
is_enabled: '{{ is_enabled }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a storage_len resource, using stack-deploy.
/*+ update */
UPDATE awscc.s3.storage_lens
SET PatchDocument = string('{{ {
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ storage_lens_configuration/id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.s3.storage_lens
WHERE
Identifier = '{{ storage_lens_configuration/id }}' 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:
| Parameter | Description |
|---|---|
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 storage_lens resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
s3:GetStorageLensConfiguration,
s3:GetStorageLensConfigurationTagging
s3:PutStorageLensConfiguration,
s3:PutStorageLensConfigurationTagging,
s3:GetStorageLensConfiguration,
s3:GetStorageLensConfigurationTagging,
organizations:DescribeOrganization,
organizations:ListAccounts,
organizations:ListAWSServiceAccessForOrganization,
organizations:ListDelegatedAdministrators,
iam:CreateServiceLinkedRole
s3:PutStorageLensConfiguration,
s3:PutStorageLensConfigurationTagging,
s3:GetStorageLensConfiguration,
s3:GetStorageLensConfigurationTagging,
organizations:DescribeOrganization,
organizations:ListAccounts,
organizations:ListAWSServiceAccessForOrganization,
organizations:ListDelegatedAdministrators,
iam:CreateServiceLinkedRole
s3:ListStorageLensConfigurations
s3:DeleteStorageLensConfiguration,
s3:DeleteStorageLensConfigurationTagging