-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
47 lines (38 loc) · 2.54 KB
/
Copy pathdeploy.ps1
File metadata and controls
47 lines (38 loc) · 2.54 KB
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
44
45
46
47
<#
.SYNOPSIS
Deploy script for AWS Automation Projects (Scraper & YouTube Summarizer).
.DESCRIPTION
This script initializes terraform, packages the lambda functions, and applies the deployment.
#>
Write-Host "==========================================================" -ForegroundColor Cyan
Write-Host " AWS Automation Projects Deploy Script " -ForegroundColor Cyan
Write-Host "==========================================================" -ForegroundColor Cyan
# Ensure we are in the script's root directory
$ScriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $ScriptRoot
Write-Host "`n[1/3] Packaging Real Estate Scraper Lambda..." -ForegroundColor Yellow
$ScraperDir = "lambda\real_estate_scraper"
if (Test-Path "$ScraperDir\package") { Remove-Item -Recurse -Force "$ScraperDir\package" }
New-Item -ItemType Directory -Force -Path "$ScraperDir\package" | Out-Null
pip install -r "$ScraperDir\requirements.txt" -t "$ScraperDir\package" --platform manylinux2014_x86_64 --only-binary=:all: --python-version 311 --upgrade --quiet
Copy-Item "$ScraperDir\scraper.py" "$ScraperDir\package\scraper.py" -Force
Write-Host "`n[2/3] Packaging YouTube Summarizer Lambda..." -ForegroundColor Yellow
$YoutubeDir = "lambda\youtube_summarizer"
if (Test-Path "$YoutubeDir\package") { Remove-Item -Recurse -Force "$YoutubeDir\package" }
New-Item -ItemType Directory -Force -Path "$YoutubeDir\package" | Out-Null
pip install -r "$YoutubeDir\requirements.txt" -t "$YoutubeDir\package" --platform manylinux2014_x86_64 --only-binary=:all: --python-version 311 --upgrade --quiet
Copy-Item "$YoutubeDir\lambda_function.py" "$YoutubeDir\package\lambda_function.py" -Force
Write-Host "`n[3/3] Running Terraform..." -ForegroundColor Yellow
Set-Location "terraform"
Write-Host "Initializing Terraform..."
terraform init
Write-Host "`nValidating Terraform configuration..."
terraform validate
Write-Host "`nApplying Terraform configuration..."
terraform apply
Write-Host "`n==========================================================" -ForegroundColor Green
Write-Host "Deploy complete! Don't forget:" -ForegroundColor Green
Write-Host "1. Confirm the SNS subscription email for the Scraper." -ForegroundColor Green
Write-Host "2. Set your Gemini API Key in the SSM Parameter Store:" -ForegroundColor Green
Write-Host " aws ssm put-parameter --name `"/scraper/youtube_summarizer/gemini_api_key`" --value `"TUACHIAVE`" --type `"SecureString`" --overwrite" -ForegroundColor Green
Write-Host "==========================================================" -ForegroundColor Green