AWS Amazon S3 File System Association
This page shows how to write Terraform for Amazon S3 File System Association and write them securely.
aws_storagegateway_file_system_association (Terraform)
The File System Association in Amazon S3 can be configured in Terraform with the resource name aws_storagegateway_file_system_association
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
The following arguments are supported:
gateway_arn
- (Required) The Amazon Resource Name (ARN) of the gateway.location_arn
- (Required) The Amazon Resource Name (ARN) of the Amazon FSx file system to associate with the FSx File Gateway.username
- (Required) The user name of the user credential that has permission to access the root share of the Amazon FSx file system. The user account must belong to the Amazon FSx delegated admin user group.password
- (Required, sensitive) The password of the user credential.audit_destination_arn
- (Optional) The Amazon Resource Name (ARN) of the storage used for the audit logs.cache_attributes
- (Optional) Refresh cache information. see Cache Attributes for more details.tags
- (Optional) Key-value map of resource tags. If configured with a providerdefault_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
cache_attributes
cache_stale_timeout_in_seconds
- (Optional) Refreshes a file share's cache by using Time To Live (TTL). TTL is the length of time since the last refresh after which access to the directory would cause the file gateway to first refresh that directory's contents from the Amazon S3 bucket. Valid Values:0
or300
to2592000
seconds (5 minutes to 30 days). Defaults to0
In addition to all arguments above, the following attributes are exported:
id
- Amazon Resource Name (ARN) of the FSx file system associationarn
- Amazon Resource Name (ARN) of the newly created file system association.tags_all
- A map of tags assigned to the resource, including those inherited from the providerdefault_tags
configuration block.
Explanation in Terraform Registry
Associate an Amazon FSx file system with the FSx File Gateway. After the association process is complete, the file shares on the Amazon FSx file system are available for access through the gateway. This operation only supports the FSx File Gateway type. FSx File Gateway requirements.
Tips: Best Practices for The Other AWS Amazon S3 Resources
In addition to the aws_s3_bucket_public_access_block, AWS Amazon S3 has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
aws_s3_bucket_public_access_block
Ensure S3 bucket-level Public Access Block restricts public bucket policies
It is better to enable S3 bucket-level Public Access Block if you don't need public buckets.
aws_s3_bucket
Ensure S3 bucket access policy is well configured
It is better to configure the S3 bucket access policy properly to limit it unless explicitly required.
CloudFormation Example
CloudFormation code does not have the related resource.