File size: 1,537 Bytes
e6c137b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

# Caltrans Payment Tracking API - AWS Lambda Deployment Script
# This script deploys the FastAPI application to AWS Lambda using SAM

set -e  # Exit on any error

echo "πŸš€ Starting deployment of Caltrans Payment Tracking API to AWS Lambda..."

# Check if SAM CLI is installed
if ! command -v sam &> /dev/null; then
    echo "❌ SAM CLI is not installed. Please install it first:"
    echo "   https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html"
    exit 1
fi

# Check if AWS CLI is configured
if ! aws sts get-caller-identity &> /dev/null; then
    echo "❌ AWS CLI is not configured. Please run 'aws configure' first."
    exit 1
fi

# Build the SAM application
echo "πŸ“¦ Building SAM application..."
sam build

# Deploy the application
echo "πŸš€ Deploying to AWS Lambda..."
sam deploy --guided

echo "βœ… Deployment completed successfully!"
echo "🌐 Your API is now available at the URL shown above."
echo ""
echo "πŸ“‹ Available endpoints:"
echo "   GET  /                                              - API information"
echo "   GET  /health                                        - Health check"
echo "   GET  /contracts/{contract_number}/payments          - Get contract payments"
echo "   GET  /contracts/{contract_number}/payments/monthly/{month} - Get monthly detailed payments"
echo ""
echo "πŸ“ Example usage:"
echo "   curl https://your-api-url/contracts/033F0704/payments"
echo "   curl https://your-api-url/contracts/033F0704/payments/monthly/2024-12"