Network Security
1. Restrict Access by IP
Recommendation: Always limit application access to trusted IP ranges. Sandbox Edition:203.0.113.45/32 (single IP address)
Production Edition:
10.0.0.0/8 (corporate network)
Important:
- Never use
0.0.0.0/0except for Let’s Encrypt validation on port 80 - Use VPN or corporate network CIDR for team access
- Update CIDR when your IP changes
2. Use Private Subnets (Production)
For production deployments, consider this architecture:- EC2 in Private Subnet: No direct internet access
- NAT Gateway: For outbound internet (updates, Docker pulls)
- Application Load Balancer: In public subnet
- RDS in Private Subnet: Never publicly accessible
- EC2 instances not directly exposed to internet
- Defense in depth security model
- Better compliance posture
3. Enable VPC Flow Logs
Monitor network traffic for security analysis:- Detect unusual traffic patterns
- Investigate security incidents
- Meet compliance requirements
IAM Security
1. Prefer SSM Session Manager Over SSH
Why:- No SSH keys to manage or lose
- All access logged to CloudTrail
- IAM-based access control
- No need to open port 22
- Centralized access management
- Automatic session logging
- Works without public IP
- No key rotation needed
2. Least Privilege IAM Policies
The CloudFormation templates create minimal IAM roles: Instance Role Permissions:AmazonSSMManagedInstanceCore- SSM Session ManagerCloudWatchAgentServerPolicy- Log shippingAWS MarketplaceMetering- Billing integration
- Admin permissions
- S3 full access
- EC2 instance manipulation
- IAM policy modification
3. Enable CloudTrail
Track all API calls for audit and compliance:- Instance start/stop
- Security group changes
- IAM role modifications
- SSM session starts
- Database access patterns
Data Protection
1. EBS Encryption
Default: Enabled in all CloudFormation templates Verify encryption:- Data encrypted at rest
- No performance impact
- Automatic key management via AWS KMS
2. RDS Encryption (Production)
Enable in CloudFormation:- Database storage
- Automated backups
- Read replicas
- Snapshots
3. RDS Automated Backups
Configure Retention:- Development: 7 days
- Production: 14-30 days
- Compliance: 30-35 days
4. Multi-AZ RDS (Production High Availability)
Enable:- Automatic failover (30-120 seconds)
- Synchronous replication
- Zero data loss
- 99.95% uptime SLA
- Automated backups from standby
Application Security
1. Change Default Database Password
After Deployment:- Minimum 12 characters
- Mix of uppercase, lowercase, numbers, special characters
- No dictionary words
- Rotate every 90 days
2. Enable HTTPS for Production
Always use custom domain with SSL/HTTPS for production:- Encrypt data in transit
- Prevent man-in-the-middle attacks
- Meet compliance requirements
- Build user trust
3. Keep AMI Updated
Subscribe to Updates:- AWS Marketplace notifications
- Aletyx security bulletins
- CVE database alerts
- Review release notes
- Test in non-production
- Schedule maintenance window
- Update CloudFormation stack
- Verify application functionality
4. Regular Security Patching
OS Updates (via SSH/SSM):- New AMI versions include updated containers
- Update to latest AMI for security patches
Access Control
1. Security Group Best Practices
Production Security Group Rules:
Never Allow:
- Port 22 from
0.0.0.0/0(SSH to internet) - Port 3306/5432 from
0.0.0.0/0(database to internet) - Outbound to suspicious IPs
2. Database Access Control
Best Practices:- RDS only accepts connections from EC2 security group
- No public IP on RDS instance
- Use IAM database authentication where possible
- Enable SSL/TLS for database connections
3. SSH Key Management
If using SSH access: Protect Keys:- Create new EC2 key pair
- Add public key to
~/.ssh/authorized_keyson instance - Test new key works
- Remove old key
- Delete old key pair from AWS
Monitoring and Auditing
1. Enable CloudWatch Alarms
Production templates include automatic alarms:- High CPU: CPU > 80% for 5 minutes
- High Database Connections: > 80% of max connections
- Low Disk Space: Free storage < 10%
2. Review CloudWatch Logs
Application Logs:3. Enable AWS Config
Track configuration changes:- Security group changes
- IAM policy modifications
- Resource deletions
- Compliance deviations
Compliance
1. Data Residency
Control Data Location:- Deploy in specific AWS regions
- Use region-locked S3 buckets
- Configure RDS in desired region
- Verify no cross-region replication
2. Encryption Requirements
At Rest:- EBS volumes encrypted (default)
- RDS storage encrypted (enable)
- S3 buckets encrypted (if used)
- HTTPS for application access
- SSL/TLS for database connections
- VPC peering for private networks
3. Audit Trail
Maintain Logs For:- Access attempts (CloudTrail)
- Configuration changes (AWS Config)
- Application events (CloudWatch Logs)
- Database queries (RDS logs)
- Development: 30 days
- Production: 90 days
- Compliance: 1-7 years
Incident Response
1. Isolate Compromised Instance
2. Collect Forensics
3. Recovery Process
- Isolate: Remove instance from production
- Investigate: Analyze logs, snapshots, network traffic
- Remediate: Patch vulnerability, update AMI
- Deploy: Launch new instance from clean AMI
- Monitor: Watch for reinfection signs
- Document: Create incident report
Security Checklist
Before going to production:- IP restrictions configured (
AllowedCidrnot0.0.0.0/0) - HTTPS enabled with valid SSL certificate
- Database password changed from default
- EBS encryption verified
- RDS encryption enabled (production)
- Multi-AZ RDS configured (production)
- Automated backups enabled (7-30 days retention)
- CloudWatch alarms configured
- CloudTrail logging enabled
- VPC Flow Logs enabled
- Security groups follow least privilege
- RDS not publicly accessible
- SSM Session Manager tested
- SSH keys secured (chmod 400) or disabled
- AMI up to date with security patches
- Incident response plan documented
Resources
- AWS Security Best Practices: AWS Well-Architected Security Pillar
- CIS AWS Foundations Benchmark: CIS Benchmarks
- Aletyx Security Documentation: https://docs.aletyx.ai/security/
Next Steps
- SSL/HTTPS Configuration: SSL/HTTPS Guide
- Troubleshooting: Troubleshooting Guide
- Sandbox Deployment: Sandbox Edition
- Production Deployment: Production Edition
Support
For security concerns:- Email: security@aletyx.com
- AWS Support: Via AWS Support Console for infrastructure issues
- Documentation: https://docs.aletyx.ai