To create a simple REST API using FastAPI in Python, follow these steps:

1. Install required packages
2. Set up the SQLite database
3. Create the FastAPI app and define the routes
4. Deploy the API on AWS Lambda using Serverless

Step 1: Install required packages

First, you need to install the required packages. You can do this by running the following command:

```bash
pip install fastapi uvicorn sqlalchemy sqlite-utils serverless-http-aws-lambda
```

Step 2: Set up the SQLite database

Create a file named `database.py` with the following content:

```python
import sqlite_utils

db = sqlite_utils.Database("notes.db")

if not db["notes"].exists():
    db["notes"].create({"id": int, "title": str, "content": str, "timestamp": str}, pk="id")
```

This will create an SQLite database named `notes.db` with a table called `notes`.

Step 3: Create the FastAPI app and define the routes

Create a file named `main.py` with the following content:

```python
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import List
from datetime import datetime
from database import db

app = FastAPI()

class Note(BaseModel):
    id: int
    title: str
    content: str
    timestamp: str


@app.post("/notes/", response_model=Note)
def create_note(note: Note):
    note.timestamp = datetime.now().isoformat()
    db["notes"].insert(note.dict())
    return note


@app.get("/notes/{note_id}", response_model=Note)
def read_note(note_id: int):
    note = db["notes"].get(note_id)
    if note:
        return note
    else:
        raise HTTPException(status_code=404, detail="Note not found")


@app.put("/notes/{note_id}", response_model=Note)
def update_note(note_id: int, note: Note):
    existing_note = db["notes"].get(note_id)
    if existing_note:
        updated_note = existing_note.update(note.dict())
        db["notes"].update(note_id, updated_note)
        return updated_note
    else:
        raise HTTPException(status_code=404, detail="Note not found")


@app.delete("/notes/{note_id}")
def delete_note(note_id: int):
    if db["notes"].get(note_id):
        db["notes"].delete(note_id)
        return {"message": "Note deleted"}
    else:
        raise HTTPException(status_code=404, detail="Note not found")
```

This code defines the FastAPI app and its routes for creating, reading, updating, and deleting notes.

Step 4: Deploy the API on AWS Lambda using Serverless

First, install the Serverless framework globally:

```bash
npm install -g serverless
```

Next, create a `serverless.yml` file with the following content:

```yaml
service: fastapi-notes

provider:
  name: aws
  runtime: python3.8
  stage: dev
  region: us-east-1

functions:
  main:
    handler: main.handler
    events:
      - httpApi:
          path: /{proxy+}
          method: ANY
      - httpApi:
          path: /
          method: ANY

plugins:
  - serverless-http-aws-lambda

custom:
  pythonRequirements:
    dockerizePip: non-linux

package:
  exclude:
    - node_modules/**
    - venv/**

```

Finally, deploy your service to AWS Lambda by running the following command:

```bash
sls deploy
```

After deployment is complete, you'll get an API endpoint URL. You can now use this URL to interact with your FastAPI app using any REST client or from the browser.

Note: To deploy the service, you need to have AWS credentials set up on your machine. Follow [these instructions](https://www.serverless.com/framework/docs/providers/aws/guide/credentials/) to set up your AWS credentials if you haven't already done so.
Python에서 FastAPI를 사용하여 간단한 REST API를 생성하려면 다음 단계를 따르세요.

1. 필요한 패키지를 설치합니다
2. SQLite 데이터베이스를 설정합니다
3. FastAPI 앱을 생성하고 경로를 정의합니다
4. 서버리스를 사용하여 AWS Lambda에 API 배포

1단계: 필수 패키지 설치

먼저 필요한 패키지를 설치해야 합니다. 다음 명령을 실행하여 설치할 수 있습니다:

```bash
pip install fastapi uvicorn sqlalchemy sqlite-utils serverless-http-aws-lambda
```

2단계: SQLite 데이터베이스 설정

다음 내용으로 `database.py`라는 파일을 생성합니다:

```python
import sqlite_utils

db = sqlite_utils.Database("notes.db")

if not db["notes"].exists():
    db["notes"].create({"id": int, "title": str, "content": str, "timestamp": str}, pk="id")
```

이렇게 하면 `notes`라는 테이블이 있는 `notes.db`라는 SQLite 데이터베이스가 생성됩니다.

3단계: FastAPI 앱 생성 및 경로 정의

다음 내용으로 `main.py`라는 파일을 생성합니다:

```python
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import List
from datetime import datetime
from database import db

app = FastAPI()

class Note(BaseModel):
    id: int
    title: str
    content: str
    timestamp: str


@app.post("/notes/", response_model=Note)
def create_note(note: Note):
    note.timestamp = datetime.now().isoformat()
    db["notes"].insert(note.dict())
    return note


@app.get("/notes/{note_id}", response_model=Note)
def read_note(note_id: int):
    note = db["notes"].get(note_id)
    if note:
        return note
    else:
        raise HTTPException(status_code=404, detail="Note not found")


@app.put("/notes/{note_id}", response_model=Note)
def update_note(note_id: int, note: Note):
    existing_note = db["notes"].get(note_id)
    if existing_note:
        updated_note = existing_note.update(note.dict())
        db["notes"].update(note_id, updated_note)
        return updated_note
    else:
        raise HTTPException(status_code=404, detail="Note not found")


@app.delete("/notes/{note_id}")
def delete_note(note_id: int):
    if db["notes"].get(note_id):
        db["notes"].delete(note_id)
        return {"message": "Note deleted"}
    else:
        raise HTTPException(status_code=404, detail="Note not found")
```

이 코드는 FastAPI 앱과 노트 생성, 읽기, 업데이트, 삭제를 위한 경로를 정의합니다.

4단계: 서버리스를 사용해 AWS Lambda에 API 배포하기

먼저 서버리스 프레임워크를 전역에 설치합니다:

```bash
npm install -g serverless
```

다음으로 다음 내용으로 `serverless.yml` 파일을 생성합니다:

```yaml
service: fastapi-notes

provider:
  name: aws
  runtime: python3.8
  stage: dev
  region: us-east-1

functions:
  main:
    handler: main.handler
    events:
      - httpApi:
          path: /{proxy+}
          method: ANY
      - httpApi:
          path: /
          method: ANY

plugins:
  - serverless-http-aws-lambda

custom:
  pythonRequirements:
    dockerizePip: non-linux

package:
  exclude:
    - node_modules/**
    - venv/**

```

마지막으로 다음 명령을 실행하여 AWS Lambda에 서비스를 배포합니다:

```bash
sls deploy
```

배포가 완료되면 API 엔드포인트 URL을 받게 됩니다. 이제 이 URL을 사용하여 REST 클라이언트 또는 브라우저에서 FastAPI 앱과 상호 작용할 수 있습니다.

주: 서비스를 배포하려면 머신에 AWS 자격 증명을 설정해야 합니다. 아직 설정하지 않았다면 [이 지침](https://www.serverless.com/framework/docs/providers/aws/guide/credentials/)을 따라 AWS 자격 증명을 설정하세요.