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

# How to Create a Downloadable File from AWS

*Last Updated: October 09, 2024*

To create a downloadable link for an object in AWS S3 you can generate a pre-signed URL. A pre-signed URL allows you to
grant temporary access to an object in your S3 bucket without exposing your credentials.

Here’s how you can generate a pre-signed URL for an object in AWS S3 using the AWS Management Console (AWS Portal):

### **Step 1: Log in to the AWS Management Console**

1. Open your web browser and navigate to the [AWS Management Console](https://aws.amazon.com/console/).
2. Log in with your AWS account credentials.

### **Step 2: Navigate to the S3 Service**

1. In the AWS Management Console, search for **"S3"** in the search bar at the top and click on **"S3"** to open the
   Amazon S3 console.
2. You'll be taken to the S3 dashboard, where you can see your list of S3 buckets.

### **Step 3: Select Your Bucket**

1. In the S3 console, click on the name of the bucket that contains the object (file) for which you want to create a
   pre-signed URL.
2. Once inside the bucket, you’ll see a list of the objects (files) stored in that bucket.

### **Step 4: Generate a Pre-Signed URL**

1. Locate the object you want to generate a pre-signed URL for.
2. Click the object name, or right-click on the object name. Click **"Share with a pre-signed URL"** under the **"Object
   actions"** dropdown.
3. In the pop-up window, set the expiration time for the URL. The expiration can range from a few minutes to several
   days, depending on how long you want the URL to be valid.
4. Once the expiration time is set, click **"Create presigned URL"**.

### **Step 5: Copy the Pre-Signed URL**

1. After generating the pre-signed URL, it will be displayed in the pop-up window.
2. Click **"Copy presigned URL"** to copy the URL to your clipboard.
3. You can now share this URL with anyone who needs temporary access to the object. The URL will provide secure,
   time-limited access to the file.

Here is how you can create an s3 presigned url programmatically using python:

### **Installation**

First, install the AWS SDK for Python (Boto3):

```bash theme={null}
pip install boto3
```

**Python Code Example:**

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

def create_presigned_url(bucket_name, object_name, expiration=3600):
    """Generate a presigned URL to share an S3 object

    :param bucket_name: string
    :param object_name: string
    :param expiration: Time in seconds for the presigned URL to remain valid
    :return: Presigned URL as string. If error, returns None.
    """

    # Generate a presigned URL for the S3 object
    s3_client = boto3.client('s3')
    try:
        response = s3_client.generate_presigned_url('get_object',
                                                    Params={'Bucket': bucket_name,
                                                            'Key': object_name},
                                                    ExpiresIn=expiration)
    except ClientError as e:
        logging.error(e)
        return None

    # The response contains the presigned URL
    return response

  url = create_presigned_url('BUCKET_NAME', 'OBJECT_NAME')

```
