Deployment Verification

After deploying the Serverless CMS platform, use these automated verification scripts to ensure all AWS resources are provisioned correctly and functioning as expected.

Note: All verification scripts are located in the scripts/ directory of your project.

Quick Start

Run the comprehensive verification script:

cd scripts
chmod +x verify-deployment.sh
./verify-deployment.sh

This will check all 13 components and 53 Lambda functions.

Verification Scripts

1. verify-deployment.sh (Bash)

Comprehensive deployment verification with color-coded output.

Features

Usage

# Default profile (cms-deploy)
./verify-deployment.sh

# Custom profile
AWS_PROFILE=my-profile ./verify-deployment.sh

# Custom region
AWS_REGION=us-east-1 ./verify-deployment.sh

Requirements

2. health-check.sh (Bash)

Ongoing health monitoring for deployed resources.

Features

Usage

# Run health check
./health-check.sh

# Schedule with cron (every 5 minutes)
*/5 * * * * /path/to/scripts/health-check.sh >> /var/log/cms-health.log 2>&1

3. verify-resources.js (Node.js)

Detailed verification with JSON output for automation.

Features

Usage

# Install dependencies first
npm install

# Run verification
npm run verify

# Or run directly
node verify-resources.js

Expected Resources

The verification scripts check for the following AWS resources:

Authentication (Global/eu-west-2)

Cognito User Pool

Compute (eu-west-2)

Lambda Functions

Storage (eu-west-2)

DynamoDB Table

S3 Buckets

APIs (eu-west-2)

API Gateway

CDN (Global)

CloudFront Distributions

DNS (Global)

Route 53

Verification Output

Successful Verification

========================================
Serverless CMS Deployment Verification
========================================

--- Checking Prerequisites ---
✓ AWS CLI installed
✓ jq installed
✓ AWS credentials configured for profile: cms-deploy

--- Verifying Cognito User Pool ---
✓ Cognito User Pool found: eu-west-2_xxxxxxxxx
✓ System group exists: admin
✓ System group exists: site-creator
✓ System group exists: site-editor
✓ System group exists: authentication-admin

--- Verifying Lambda Functions ---
✓ Lambda functions found: 53 (expected: 53)
✓ All Lambda functions use correct runtime (nodejs22.x)

--- Verifying DynamoDB Table ---
✓ DynamoDB table exists and is ACTIVE
✓ Global Secondary Indexes configured: 2

--- Verifying S3 Buckets ---
✓ S3 bucket exists: serverless-cms-deploy-artifacts-xxxxx
✓ S3 bucket exists: serverless-cms-component-store-xxxxx
✓ S3 bucket exists: serverless-cms-asset-store-xxxxx
✓ S3 bucket exists: serverless-cms-publish-store-xxxxx
✓ S3 bucket exists: serverless-cms-backup-store-xxxxx

--- Verifying API Gateway ---
✓ CMS API Gateway found: xxxxxxxxxx
✓ Public API Gateway found: xxxxxxxxxx

--- Verifying CloudFront Distributions ---
✓ CloudFront distributions found: 2 (expected: 2)
✓ Distribution E1234567890ABC: Deployed

--- Verifying Route 53 DNS Records ---
✓ Route 53 hosted zone found: Z1234567890ABC
✓ DNS record exists: admin.example.com
✓ DNS record exists: cms-api.example.com
✓ DNS record exists: api.example.com

--- Testing Endpoints ---
✓ Admin Tool accessible: https://admin.example.com
✓ CMS API accessible: https://cms-api.example.com/sites (returns 401 as expected)
✓ Public API accessible: https://api.example.com/sites/test/meta (returns 404)

--- Verification Summary ---
Total checks: 45
Passed: 45
Failed: 0
Warnings: 0

✓ All critical checks passed!

Failed Verification

--- Verifying Lambda Functions ---
⚠ Lambda functions found: 48 (expected: 53)
✗ 2 Lambda functions have incorrect runtime

--- Verification Summary ---
Total checks: 45
Passed: 40
Failed: 2
Warnings: 3

✗ Some checks failed. Review the output above.

Common Issues

CloudFront Distributions Not Deployed

Symptom: Distributions show "In Progress" status

Solution: CloudFront distributions take 15-30 minutes to deploy. Wait and re-run verification.

DNS Records Not Found

Symptom: Route 53 records missing

Solution: Verify hosted zone exists and deployment completed successfully. DNS propagation can take up to 48 hours.

Lambda Functions Missing

Symptom: Fewer than 53 functions found

Solution: Check deployment logs. Re-run deployment if necessary:

mvn clean package serverless:deploy

API Gateway Returns 000

Symptom: Endpoint tests return HTTP 000

Solution: DNS may not be propagated yet. Wait and retry. Check CloudFront distribution status.

Manual Verification

If automated scripts fail, you can manually verify resources using AWS CLI:

Check Cognito User Pool

aws cognito-idp list-user-pools \
  --max-results 10 \
  --profile cms-deploy \
  --region eu-west-2

Check Lambda Functions

aws lambda list-functions \
  --profile cms-deploy \
  --region eu-west-2 \
  | grep serverless-cms

Check DynamoDB Table

aws dynamodb describe-table \
  --table-name serverless-cms-content-store \
  --profile cms-deploy \
  --region eu-west-2

Check S3 Buckets

aws s3 ls --profile cms-deploy | grep serverless-cms

Check API Gateway

aws apigateway get-rest-apis \
  --profile cms-deploy \
  --region eu-west-2

Check CloudFront Distributions

aws cloudfront list-distributions --profile cms-deploy

Check Route 53 Records

aws route53 list-hosted-zones --profile cms-deploy

CI/CD Integration

Integrate verification into your CI/CD pipeline:

GitHub Actions

name: Verify Deployment
on:
  workflow_dispatch:
  schedule:
    - cron: '0 */6 * * *'  # Every 6 hours

jobs:
  verify:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v2
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-2
      
      - name: Run Verification
        run: |
          cd scripts
          chmod +x verify-deployment.sh
          ./verify-deployment.sh

Monitoring Setup

Cron Job for Regular Health Checks

# Health check every 5 minutes
*/5 * * * * /path/to/scripts/health-check.sh >> /var/log/cms-health.log 2>&1

# Full verification daily at 2 AM
0 2 * * * /path/to/scripts/verify-deployment.sh >> /var/log/cms-verify.log 2>&1

CloudWatch Alarms

# Lambda error alarm
aws cloudwatch put-metric-alarm \
  --alarm-name serverless-cms-lambda-errors \
  --alarm-description "Alert on Lambda errors" \
  --metric-name Errors \
  --namespace AWS/Lambda \
  --statistic Sum \
  --period 300 \
  --evaluation-periods 1 \
  --threshold 10 \
  --comparison-operator GreaterThanThreshold \
  --profile cms-deploy \
  --region eu-west-2

Next Steps

After successful verification:

  1. Configure your first admin user
  2. Create your first site
  3. Set up monitoring and backups