# AWS

All functionality related to [Amazon AWS](https://aws.amazon.com/) platform

## LLMs

### Bedrock

See a [usage example](/docs/integrations/llms/bedrock).

```python
from langchain.llms.bedrock import Bedrock
```

### Amazon API Gateway

[Amazon API Gateway](https://aws.amazon.com/api-gateway/) is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale. APIs act as the "front door" for applications to access data, business logic, or functionality from your backend services. Using API Gateway, you can create RESTful APIs and WebSocket APIs that enable real-time two-way communication applications. API Gateway supports containerized and serverless workloads, as well as web applications.

API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, CORS support, authorization and access control, throttling, monitoring, and API version management. API Gateway has no minimum fees or startup costs. You pay for the API calls you receive and the amount of data transferred out and, with the API Gateway tiered pricing model, you can reduce your cost as your API usage scales.

See a [usage example](/docs/integrations/llms/amazon_api_gateway_example).

```python
from langchain.llms import AmazonAPIGateway

api_url = "https://<api_gateway_id>.execute-api.<region>.amazonaws.com/LATEST/HF"
# These are sample parameters for Falcon 40B Instruct Deployed from Amazon SageMaker JumpStart
model_kwargs = {
    "max_new_tokens": 100,
    "num_return_sequences": 1,
    "top_k": 50,
    "top_p": 0.95,
    "do_sample": False,
    "return_full_text": True,
    "temperature": 0.2,
}
llm = AmazonAPIGateway(api_url=api_url, model_kwargs=model_kwargs)
```

### SageMaker Endpoint

>[Amazon SageMaker](https://aws.amazon.com/sagemaker/) is a system that can build, train, and deploy machine learning (ML) models with fully managed infrastructure, tools, and workflows.

We use `SageMaker` to host our model and expose it as the `SageMaker Endpoint`.

See a [usage example](/docs/integrations/llms/sagemaker).

```python
from langchain.llms import SagemakerEndpoint
from langchain.llms.sagemaker_endpoint import LLMContentHandler
```

## Text Embedding Models

### Bedrock

See a [usage example](/docs/integrations/text_embedding/bedrock).
```python
from langchain.embeddings import BedrockEmbeddings
```

### SageMaker Endpoint

See a [usage example](/docs/integrations/text_embedding/sagemaker-endpoint).
```python
from langchain.embeddings import SagemakerEndpointEmbeddings
from langchain.llms.sagemaker_endpoint import ContentHandlerBase
```


## Document loaders

### AWS S3 Directory and File
>[Amazon Simple Storage Service (Amazon S3)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html) is an object storage service.
>[AWS S3 Directory](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html)
>[AWS S3 Buckets](https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingBucket.html)

See a [usage example for S3DirectoryLoader](/docs/integrations/document_loaders/aws_s3_directory).

See a [usage example for S3FileLoader](/docs/integrations/document_loaders/aws_s3_file).

```python
from langchain.document_loaders import S3DirectoryLoader, S3FileLoader
```

## Memory

### AWS DynamoDB

>[AWS DynamoDB](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/index.html) 
> is a fully managed `NoSQL` database service that provides fast and predictable performance with seamless scalability.
 
We have to configure the [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html). 

We need to install the `boto3` library.

```bash
pip install boto3
```

See a [usage example](/docs/integrations/memory/aws_dynamodb).

```python
from langchain.memory import DynamoDBChatMessageHistory
```
