Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon How do I create and configure an S3 bucket for DeepSeek


How do I create and configure an S3 bucket for DeepSeek


Creating and configuring an S3 bucket for DeepSeek involves several steps. Here's a detailed guide on how to accomplish this:

Step 1: Create an S3 Bucket

1. Access the AWS Management Console: Sign in to your AWS account and navigate to the AWS Management Console.
2. Open the S3 Console: In the search bar, type "S3" and click on the service.
3. Create a Bucket: Click on "Create bucket."
4. Choose a Bucket Name: Enter a unique name for your bucket. The name must be between 3 and 63 characters long, consisting only of lowercase letters, numbers, dots (.), and hyphens (-). It should begin and end with a letter or number.
5. Select a Region: Choose a region for your bucket. For DeepSeek, it's recommended to use a region that supports Amazon Bedrock, such as us-east-1 or us-west-2.
6. Create the Bucket: Keep the default settings and click "Create bucket."

Step 2: Create an IAM Role for S3 Access

1. Navigate to IAM: In the AWS Management Console, search for "IAM" and click on it.
2. Create a Role: Click on "Roles" and then "Create role."
3. Select Trusted Entity Type: Choose "AWS service" and select "S3" as the use case.
4. Attach Policy: Add the AmazonS3FullAccess policy to your role. This policy grants full access to S3, which is suitable for testing purposes.
5. Name the Role: Give your role a name, such as DeepSeekBedrock.
6. Review and Create: Review the settings and click "Create role."

Step 3: Upload DeepSeek Model Artifacts to S3

1. Download the Model: Use the Hugging Face Hub to download the DeepSeek model artifacts. You can use Python with the `huggingface_hub` library to download the model.

python
    from huggingface_hub import snapshot_download
    repo_id = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
    local_dir = snapshot_download(repo_id)
    print(f"Model downloaded to: {local_dir}")
    

2. Upload to S3: Use the `boto3` library to upload the model artifacts to your S3 bucket. Ensure you have the AWS CLI configured with your credentials.

python
    import boto3
    import os

    # Set your S3 bucket name
    bucket_name = "your-s3-bucket-name"
    s3_prefix = "DeepSeek-R1-Distill-Llama-8B"

    # Create an S3 client
    s3_client = boto3.client('s3')

    # Upload files to S3
    for root, dirs, files in os.walk(local_dir):
        for filename in files:
            local_file_path = os.path.join(root, filename)
            s3_key = f"models/{os.path.relpath(local_file_path, local_dir)}"
            print(f"Uploading {local_file_path} to s3://{bucket_name}/{s3_key}")
            s3_client.upload_file(local_file_path, bucket_name, s3_key)
    

Step 4: Configure and Import the Model in Amazon Bedrock

1. Navigate to Amazon Bedrock: Go to the AWS Management Console and open Amazon Bedrock.
2. Import the Model: Click on "Imported models" and then "Import model."
3. Configure the Import Job: Enter a model name and select your S3 bucket as the import source. Provide the S3 path to your model artifacts (e.g., `s3://your-s3-bucket-name/DeepSeek-R1-Distill-Llama-8B/`).
4. Start the Import Job: Click "Import" to begin the process. Once complete, the model will be available for use in Amazon Bedrock.

By following these steps, you can successfully create and configure an S3 bucket for DeepSeek and integrate it with Amazon Bedrock.

Citations:
[1] https://tutorialsdojo.com/deepseek-in-amazon-bedrock-a-comprehensive-demo/
[2] https://n8n.io/integrations/aws-s3/and/deepseek-chat-model/
[3] https://docs.aws.amazon.com/AmazonS3/latest/userguide/GetStartedWithS3.html
[4] https://getstream.io/blog/deepseek-chat/
[5] https://www.linkedin.com/pulse/deepseek-aws-bedrock-andrew-larssen-cobge
[6] https://community.aws/content/2sIJqPaPMtmNxlRIQT5CzpTtziA/deploy-deepseek-r1-on-aws-bedrock?lang=en
[7] https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-buckets-s3.html
[8] https://www.kloia.com/blog/how-to-deploy-deepseek-r1-distill-llama-8b-on-aws
[9] https://crossasyst.com/blog/deepseek-r1-on-aws-bedrock/