> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# S3 Buckets Should Use Transfer Acceleration

### More Info:

S3 buckets should be using Transfer Acceleration feature to increase the speed (up to 500%) of data transfers in and out of Amazon S3 using AWS edge network.

### Risk Level

Low

### Address

Operational Maturity, Security

### Compliance Standards

* APRA CPS 234 (Australia)
* BSI C5 (Germany)
* Brazil LGPD
* CCPA / CPRA (California)
* CIS Critical Security Controls v8
* CMMC 2.0
* CSA Cloud Controls Matrix v4
* Cloudanix Best Practice
* DPDPA
* Digital Operational Resilience Act (EU)
* Essential 8
* ISO/IEC 27017
* ISO/IEC 27018
* ISO/IEC 27701
* KSA PDPL
* MAS Technology Risk Management (Singapore)
* NIS2 Directive
* NIST SP 800-171
* NYDFS 23 NYCRR 500
* SWIFT Customer Security Controls Framework
* Sarbanes-Oxley IT General Controls
* UK NCSC Cyber Assessment Framework

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        Sure, here are the step-by-step instructions to remediate the misconfiguration in AWS:

        1. Log in to your AWS Management Console.
        2. Navigate to the S3 service.
        3. Select the bucket that you want to remediate.
        4. Click on the Properties tab.
        5. Scroll down to the Transfer Acceleration section.
        6. Click on the Edit button.
        7. Select the Enable Transfer Acceleration option.
        8. Click on Save changes.

        That's it! You have now enabled Transfer Acceleration for your S3 bucket. This will ensure that data transfer to and from your bucket is faster and more reliable.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the misconfiguration "S3 Buckets Should Use Transfer Acceleration" for AWS using AWS CLI, you can follow the below steps:

        1. Open the AWS CLI on your local machine.

        2. Run the following command to enable transfer acceleration on an S3 bucket:

        ```
        aws s3api put-bucket-accelerate-configuration --bucket BUCKET_NAME --accelerate-configuration Status=Enabled
        ```

        Replace `BUCKET_NAME` with the name of the S3 bucket that you want to enable transfer acceleration for.

        3. Verify that transfer acceleration is enabled for the S3 bucket by running the following command:

        ```
        aws s3api get-bucket-accelerate-configuration --bucket BUCKET_NAME
        ```

        This command will return the current status of transfer acceleration for the specified S3 bucket.

        4. Repeat steps 2-3 for any other S3 buckets that need transfer acceleration enabled.

        By following these steps, you can remediate the misconfiguration "S3 Buckets Should Use Transfer Acceleration" for AWS using AWS CLI.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the misconfiguration of not using transfer acceleration for S3 Buckets in AWS using Python, you can follow these steps:

        1. Import the necessary AWS SDK libraries: boto3 and botocore.

        ```python theme={null}
        import boto3
        from botocore.exceptions import ClientError
        ```

        2. Create a boto3 S3 client object.

        ```python theme={null}
        s3 = boto3.client('s3')
        ```

        3. Get a list of all S3 buckets in your AWS account.

        ```python theme={null}
        bucket_list = s3.list_buckets()
        ```

        4. Iterate through the list of buckets and enable transfer acceleration for each bucket.

        ```python theme={null}
        for bucket in bucket_list['Buckets']:
            bucket_name = bucket['Name']
            try:
                response = s3.put_bucket_accelerate_configuration(
                    Bucket=bucket_name,
                    AccelerateConfiguration={
                        'Status': 'Enabled'
                    }
                )
                print(f"Transfer acceleration enabled for bucket: {bucket_name}")
            except ClientError as e:
                if e.response['Error']['Code'] == 'NoSuchBucket':
                    print(f"Bucket {bucket_name} does not exist.")
                else:
                    print(f"Error enabling transfer acceleration for bucket {bucket_name}: {e}")
        ```

        5. Save the Python script and run it to enable transfer acceleration for all S3 buckets in your AWS account.

        Note: You must have appropriate AWS credentials configured in your environment to access your AWS account and make changes to S3 buckets.
      </Accordion>

      <Accordion title="Using Terraform">
        ```hcl theme={null}
        resource "aws_s3_bucket" "this" {
          bucket = "YOUR_BUCKET_NAME" # replace with your bucket name
        }

        # Enables S3 Transfer Acceleration on the bucket, matching:
        # aws s3api put-bucket-accelerate-configuration --accelerate-configuration '{"Status": "Enabled"}'
        resource "aws_s3_bucket_accelerate_configuration" "this" {
          bucket = aws_s3_bucket.this.id

          status = "Enabled"
        }
        ```

        Enabling Transfer Acceleration is an in-place change and does not force bucket replacement, but it may incur additional data transfer costs and requires using the `YOUR_BUCKET_NAME.s3-accelerate.amazonaws.com` endpoint in your applications.

        For verification, `terraform plan` should show one new `aws_s3_bucket_accelerate_configuration` resource with `status` changing from `""` (or `Suspended`) to `"Enabled"` and no `aws_s3_bucket.this` replacement.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>

### Additional Reading:

* [https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/transfer-acceleration.html)
