feat: Add ALB+S3 VPC hosting mode as alternative to CloudFront for private network deployments#245
Conversation
- Add WebUIHosting parameter (CloudFront/ALB) to main template - Add ALB hosting nested stack (VPC endpoint, security groups, target registration, listener rules) - Add ELB access log permissions to logging bucket policy - Make CloudFront resources conditional on UseCloudFrontHosting - Make S3 website configuration conditional (disabled for ALB mode) - Scope VPC endpoint policy to WebUI bucket only - Update CORS origins, Cognito callbacks, CodeBuild env vars for ALB mode - Add self-signed cert generation script for testing - Register alb-hosting as build component in publish.py
…ted parameter parsing
|
My buddy, Cline, found a few small issues @rcgeorge .. Can you address them? Issues Found 🔍🔴 Issue 1: ALB Security Group only allows FIRST CIDR when multiple are provided (Medium-High Severity)SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: !If
- UseVpcCidr
- !GetAtt VpcCidrLookup.CidrBlock
- !Select [0, !Split [",", !Ref ALBAllowedCIDRs]]When a user provides Recommendation: Either:
🟡 Issue 2: S3 VPC Endpoint Policy uses
|
- Replace single-CIDR SG ingress with SGIngressManager custom resource Lambda that handles multiple comma-separated CIDRs with VPC CIDR fallback - Scope VPC endpoint policy from s3:* to s3:GetObject and s3:ListBucket - Add Update event handling to RegisterTargetsFunction Lambda with UpdateToken property to re-register targets when VPC endpoint changes - Add descriptions to all security group ingress/egress rules - Add explicit ALB-to-endpoint egress rule scoped to endpoint SG
8ff24e2
into
aws-solutions-library-samples:develop
Adds an alternative web UI hosting mode using Application Load Balancer (ALB) with S3 VPC Interface Endpoint for environments that require VPC-based hosting (private networks, regulated environments, corporate networks without internet-facing CDN access).
Changes
ALB Hosting Infrastructure (
nested/alb-hosting/template.yaml)Main Template (
template.yaml)WebUIHostingparameter (CloudFront|ALB) with conditional resource creationUseCloudFrontHosting/UseALBHostingconditions gating CloudFront and ALB resourcesaws:sourceVpcecondition for ALB mode instead of CloudFront OAIALBHOSTINGSTACKto match existing convention (PATTERNSTACK,APPSYNCSTACK, etc.)CLI Fix (
lib/idp_cli_pkg/idp_cli/cli.py)--parametersparsing to handle comma-delimited values (e.g.,ALBSubnetIds=subnet-a,subnet-b) — previously the naivesplit(",")broke values containing commasHelper Script (
scripts/generate_self_signed_cert.sh)Publish Script (
publish.py)nested/alb-hostingas a build componentDocumentation
docs/alb-hosting.md— when/why to use ALB hosting, VPC prerequisites, deployment steps, security considerations, troubleshooting, CloudFront vs ALB comparisondocs/architecture.md,docs/aws-services-and-roles.md,docs/configuration.md,docs/web-ui.md,docs/well-architected.mdwith ALB hosting references alongside existing CloudFront contentdocs/README.mdwith link to new docTesting
WebUIHosting=ALBusingidp-cli deploy --from-codeagainstcustomer-vpc(private subnets, self-signed cert, internal ALB scheme)CREATE_COMPLETE) with ALB serving the web UImake check-arn-partitions,make ruff-lint,make format,make validate-buildspec)