Syncs public Google Docs to an S3 bucket as plain text files.
| Document ID | Source URL |
|---|---|
1juZcZg0ygOesa4LLWOuULUu501BGaBWW3dtvQZQzJr8 |
Link |
1-QCHQaGe44fB4w4OkAwYdcZFW1X8nAjwj2jbNbFf5lg |
Link |
15kZEyxk1EaEx2yJ-CghO8ZYHcgVCjmG9LXaMAAkbVQQ |
Link |
1bGJlcbhu7CGs6D6DqP831jL0EnoGQQa_l68m9J1s-20 |
Link |
- AWS CLI configured with appropriate credentials
- AWS SAM CLI installed (installation guide)
- Python 3.11+
Test fetching the documents locally (doesn't upload to S3):
python lambda_function.py-
Build the application:
sam build
-
Deploy (first time - guided):
sam deploy --guided
You'll be prompted for:
- Stack name (e.g.,
gdrivesync) - AWS Region
- BucketName parameter (must be globally unique)
- Stack name (e.g.,
-
Deploy (subsequent):
sam deploy
-
Create the S3 bucket:
aws s3 mb s3://your-bucket-name
-
Create a ZIP package:
zip lambda.zip lambda_function.py
-
Create the Lambda function:
aws lambda create-function \ --function-name gdrivesync-function \ --runtime python3.11 \ --handler lambda_function.lambda_handler \ --zip-file fileb://lambda.zip \ --role arn:aws:iam::YOUR_ACCOUNT:role/YOUR_LAMBDA_ROLE \ --timeout 60 \ --memory-size 256 \ --environment Variables="{S3_BUCKET_NAME=your-bucket-name}"
Trigger the Lambda manually:
aws lambda invoke \
--function-name gdrivesync-function \
--payload '{}' \
response.json
cat response.jsons3://your-bucket/
├── docs/
│ ├── 1juZcZg0ygOesa4LLWOuULUu501BGaBWW3dtvQZQzJr8.txt
│ ├── 1-QCHQaGe44fB4w4OkAwYdcZFW1X8nAjwj2jbNbFf5lg.txt
│ ├── 15kZEyxk1EaEx2yJ-CghO8ZYHcgVCjmG9LXaMAAkbVQQ.txt
│ ├── 1bGJlcbhu7CGs6D6DqP831jL0EnoGQQa_l68m9J1s-20.txt
│ └── _manifest.json
By default, the Lambda runs daily at 6 AM UTC. To modify, edit the Schedule in template.yaml.
Edit GOOGLE_DOC_IDS in lambda_function.py and redeploy.