Lesson 05 β Enterprise DevSecOps & Infrastructure as Code (IaC) Security Project & Module Review
Learning Path
βοΈ Phase 02 β AWS Cloud Security
π Module 11 β DevSecOps & Infrastructure as Code (IaC) Security
π― Lesson Objective
Section titled βπ― Lesson ObjectiveβBy the end of this capstone project, you will be able to:
- Design an enterprise DevSecOps architecture.
- Build secure Infrastructure as Code.
- Design secure CI/CD pipelines.
- Integrate automated security testing.
- Secure application secrets.
- Protect software supply chains.
- Design deployment approval workflows.
- Build secure production deployments.
- Monitor the DevSecOps platform.
- Present an executive security review.
π Lesson Information
Estimated Time: 8β10 Hours
Difficulty: Advanced
Prerequisites: Lessons 01β04
Capstone Project: Yes
πΌ Enterprise Business Scenario
Section titled βπΌ Enterprise Business ScenarioβCloudNova Technologies has rapidly expanded into a global cloud provider delivering financial, healthcare and retail applications.
Current environment:
- 120 AWS Accounts
- 8 AWS Regions
- 450 Developers
- 70 DevOps Engineers
- 40 Cloud Security Engineers
- 300 GitHub Repositories
- 150 Microservices
- Amazon EKS Clusters
- Amazon ECS Services
- AWS Lambda Applications
- Terraform Infrastructure
- CloudFormation Templates
- Multiple CI/CD Pipelines
The organization performs hundreds of deployments every week.
A recent third-party security assessment discovered:
- AWS Access Keys committed to Git repositories.
- Public S3 buckets deployed through Terraform.
- Container images containing Critical CVEs.
- Production deployments bypassing approvals.
- Shared IAM roles across all environments.
- Missing secret rotation.
- Manual infrastructure changes causing drift.
- No policy enforcement for Infrastructure as Code.
- Developers deploying directly to production.
- Security testing performed only before quarterly releases.
The Board of Directors has instructed the CISO to implement an enterprise DevSecOps platform that delivers:
- Secure software delivery
- Automated security testing
- Infrastructure as Code governance
- Secure secrets management
- Production approval workflows
- Continuous compliance
- Continuous monitoring
- Enterprise audit capability
As the Lead Cloud Security Engineer, you have been assigned to design the complete solution.
π’ Enterprise Environment
Section titled βπ’ Enterprise EnvironmentβCloudNova operates the following AWS environments:
Developers
β
GitHub Enterprise
β
Secure Pull Requests
β
AWS CodePipeline
β
AWS CodeBuild
β
Automated Security Validation
β
βββββββββββββββββΌβββββββββββββββββ β β β SAST Scan Secret Scan IaC Scan β β β βββββββββββββββββΌβββββββββββββββββ β Dependency Scan β Container Scan β Artifact Repository β Staging Environment β Manual Approval Gate β Production Deployment β CloudTrail β’ CloudWatch β’ Security Hub β Continuous Monitoringπ Phase 1 β Assess Current Environment
Section titled βπ Phase 1 β Assess Current EnvironmentβPerform a complete assessment.
Review:
- Git repositories
- CI/CD pipelines
- IAM roles
- Terraform templates
- CloudFormation templates
- Docker images
- Secrets
- AWS Accounts
- Deployment process
Document:
- Existing risks
- Existing controls
- Missing controls
- Business impact
π Phase 2 β Design Secure DevSecOps Architecture
Section titled βπ Phase 2 β Design Secure DevSecOps ArchitectureβDesign:
- Source Control
- Branch Protection
- Secure Build Pipeline
- Secure Deployment Pipeline
- Multi-Account Strategy
- Secrets Management
- Monitoring
- Security Operations
Deliverables:
- Architecture Diagram
- Security Controls
- Data Flow
- Trust Boundaries
π Phase 3 β Secure Infrastructure as Code
Section titled βπ Phase 3 β Secure Infrastructure as CodeβReview all Infrastructure as Code.
Tasks:
- Validate CloudFormation
- Validate Terraform
- Remove hardcoded values
- Enable encryption
- Enable logging
- Apply least privilege
- Configure tagging
- Enable drift detection
- Configure policy validation
Document:
- Issues identified
- Remediation
- Final architecture
π Phase 4 β Secure CI/CD Pipeline
Section titled βπ Phase 4 β Secure CI/CD PipelineβBuild a secure deployment pipeline.
Pipeline must include:
- Pull Request
- Peer Review
- Build
- Unit Tests
- SAST
- Secret Scan
- Dependency Scan
- IaC Scan
- Container Scan
- Manual Approval
- Production Deployment
Workflow:
Developer
β
GitHub
β
Pull Request
β
Code Review
β
Security Validation
β
AWS CodeBuild
β
Artifact
β
Approval
β
Productionπ Phase 5 β Implement Security Testing
Section titled βπ Phase 5 β Implement Security TestingβAutomate:
- Static Analysis
- Dependency Scanning
- Secret Scanning
- IaC Scanning
- Container Image Scanning
Define:
- Severity Levels
- Blocking Criteria
- Exception Process
- Approval Workflow
π Phase 6 β Secure Secrets
Section titled βπ Phase 6 β Secure SecretsβReplace:
β Hardcoded Passwords
β API Keys
β Database Credentials
With:
β AWS Secrets Manager
β Parameter Store
Configure:
- IAM Policies
- KMS Encryption
- Secret Rotation
- Logging
- Monitoring
π Phase 7 β Secure Container Platform
Section titled βπ Phase 7 β Secure Container PlatformβReview:
- Docker Images
- Base Images
- Image Tags
- Root Users
- Image Vulnerabilities
Implement:
- Amazon ECR
- Image Scanning
- Immutable Tags
- Image Signing
- Deployment Policies
π Phase 8 β Monitoring & Incident Response
Section titled βπ Phase 8 β Monitoring & Incident ResponseβImplement monitoring using:
- CloudTrail
- CloudWatch
- EventBridge
- Security Hub
- GuardDuty
- Inspector
Create alerts for:
- Failed Builds
- Secret Access
- Pipeline Failure
- Production Deployment
- Drift Detection
- Vulnerability Detection
- Failed Security Gates
π Phase 9 β Executive Security Dashboard
Section titled βπ Phase 9 β Executive Security DashboardβPrepare dashboards showing:
- Deployment Frequency
- Failed Builds
- Critical Vulnerabilities
- High Vulnerabilities
- Secret Rotation Status
- Security Gate Failures
- Drift Detection
- Production Deployments
- Mean Time to Recovery
- Compliance Status
π’ Enterprise Deliverables
Section titled βπ’ Enterprise DeliverablesβSubmit the following documents.
Architecture
Section titled βArchitectureβ- Enterprise DevSecOps Architecture
- CI/CD Architecture
- Multi-Account Design
- Trust Boundaries
Infrastructure
Section titled βInfrastructureβ- Terraform Modules
- CloudFormation Templates
- IAM Design
- KMS Design
Security
Section titled βSecurityβ- Security Standards
- Pipeline Security Controls
- Secret Management Policy
- Container Security Policy
- IaC Standards
- Build Security Standard
Operations
Section titled βOperationsβ- Monitoring Strategy
- Incident Response Plan
- Secret Rotation Plan
- Deployment Process
- Change Management
Executive Reports
Section titled βExecutive Reportsβ- Risk Assessment
- Security Scorecard
- Lessons Learned
- Final Recommendations
π Enterprise Capstone Lab
Section titled βπ Enterprise Capstone LabβYou have been hired to redesign CloudNovaβs complete DevSecOps platform.
Your platform must include:
β GitHub
β AWS CodePipeline
β AWS CodeBuild
β Terraform
β CloudFormation
β Secrets Manager
β Parameter Store
β IAM Roles
β Amazon ECR
β Security Hub
β CloudTrail
β CloudWatch
β Amazon Inspector
All deployments must follow enterprise security standards.
π» AWS CLI Challenge
Section titled βπ» AWS CLI ChallengeβList CodePipeline Pipelines
Section titled βList CodePipeline Pipelinesβaws codepipeline list-pipelinesList Build Projects
Section titled βList Build Projectsβaws codebuild list-projectsList Secrets
Section titled βList Secretsβaws secretsmanager list-secretsList Parameters
Section titled βList Parametersβaws ssm describe-parametersList ECR Repositories
Section titled βList ECR Repositoriesβaws ecr describe-repositoriesList Inspector Findings
Section titled βList Inspector Findingsβaws inspector2 list-findingsValidate CloudFormation
Section titled βValidate CloudFormationβaws cloudformation validate-template \--template-body file://template.yamlDetect CloudFormation Drift
Section titled βDetect CloudFormation Driftβaws cloudformation detect-stack-drift \--stack-name SecureStackVerify Current Identity
Section titled βVerify Current Identityβaws sts get-caller-identityπ Final Security Review
Section titled βπ Final Security ReviewβReview the environment.
Verify:
β Infrastructure as Code
β Secure CI/CD
β Secrets Management
β Security Testing
β Container Security
β IAM
β Encryption
β Monitoring
β Logging
β Compliance
β Production Controls
π Incident Investigation
Section titled βπ Incident InvestigationβCloudNova experienced the following incident.
Timeline:
09:00 β Developer commits AWS Secret Key
09:02 β Secret Scan detects credential
09:03 β Build automatically fails
09:04 β Security Team notified
09:06 β Secret rotated
09:12 β Repository cleaned
09:20 β Build rerun successfully
Questions:
- Which security controls worked?
- How was the incident contained?
- What additional improvements would you recommend?
π’ Enterprise Best Practices
Section titled βπ’ Enterprise Best PracticesβCloudNova standards:
- Security built into every stage
- Shift Left Security
- Least Privilege IAM
- Infrastructure as Code
- Automated Security Testing
- Immutable Infrastructure
- Continuous Monitoring
- Secure Secrets Management
- Automated Compliance
- Continuous Improvement
π« Common Mistakes
Section titled βπ« Common Mistakesββ Deploying directly to production.
β Hardcoding credentials.
β Skipping Pull Requests.
β Ignoring security scans.
β AdministratorAccess for pipelines.
β Manual infrastructure changes.
β No drift detection.
β No secret rotation.
β Sharing production credentials.
β No monitoring.
π§ͺ Final Enterprise Challenge
Section titled βπ§ͺ Final Enterprise ChallengeβCloudNova plans to expand globally.
Design a complete enterprise DevSecOps platform supporting:
- 500+ Developers
- 1,000+ Repositories
- Multi-Region
- Multi-Account
- Kubernetes
- Serverless
- Hybrid Cloud
- Continuous Deployment
- Compliance Automation
- Zero Trust
- AI-assisted Security Reviews
- Enterprise Governance
Prepare:
- Architecture
- Network Diagram
- IAM Design
- CI/CD Design
- Terraform Repository Structure
- CloudFormation Repository
- Security Controls Matrix
- Secrets Strategy
- Monitoring Strategy
- Incident Response Plan
- Executive Presentation
π Module Review
Section titled βπ Module ReviewβThroughout Module 11 you learned:
Lesson 01
Section titled βLesson 01β- DevSecOps Fundamentals
- Secure SDLC
- Shift Left Security
- DevSecOps Culture
Lesson 02
Section titled βLesson 02β- Infrastructure as Code
- AWS CloudFormation
- Terraform
- Secure Templates
- Drift Detection
Lesson 03
Section titled βLesson 03β- CI/CD Pipeline Security
- AWS CodePipeline
- AWS CodeBuild
- Secure Deployments
- Pipeline Monitoring
Lesson 04
Section titled βLesson 04β- SAST
- DAST
- SCA
- Secret Scanning
- Secrets Manager
- Parameter Store
- Container Security
- Amazon Inspector
π Knowledge Check
Section titled βπ Knowledge Checkβ- Why is DevSecOps important?
- What is Shift Left Security?
- Why should Infrastructure as Code be scanned?
- What are the stages of a secure CI/CD pipeline?
- Why should production require approvals?
- What is the purpose of SAST?
- How does DAST differ from SAST?
- Why should secrets never be stored in source code?
- What is the purpose of AWS Secrets Manager?
- How does Amazon Inspector improve container security?
- What is Infrastructure Drift?
- Why is least privilege important for pipelines?
- Why should all deployments be monitored?
- How should security findings be prioritised?
- What are the key characteristics of an enterprise DevSecOps platform?
π‘ Key Takeaways
Section titled βπ‘ Key TakeawaysβAfter completing Module 11, you should be able to:
- Design and implement a secure DevSecOps operating model that integrates security throughout the software development lifecycle.
- Build Infrastructure as Code using CloudFormation and Terraform while applying secure defaults, policy validation and drift detection.
- Design CI/CD pipelines with automated security gates, least-privilege IAM roles, protected branches and controlled production approvals.
- Integrate multiple layers of security testing, including SAST, DAST, SCA, IaC validation, secret scanning and container image scanning.
- Protect application credentials using AWS Secrets Manager and Systems Manager Parameter Store with encryption, least privilege and rotation.
- Secure container-based workloads and software supply chains through image scanning, immutable artefacts and continuous monitoring.
- Detect, investigate and respond to DevSecOps security incidents using CloudTrail, CloudWatch, Security Hub, Amazon Inspector and related AWS services.
- Produce enterprise-ready documentation, governance artefacts and executive reports that support operational excellence, compliance and continuous improvement.
π Module Complete
Section titled βπ Module CompleteβCongratulations!
You have successfully completed:
Module 11 β DevSecOps & Infrastructure as Code (IaC) Security
Section titled βModule 11 β DevSecOps & Infrastructure as Code (IaC) SecurityβYou now understand how modern enterprises securely build, test, deploy and operate cloud-native applications using DevSecOps principles, Infrastructure as Code, secure CI/CD pipelines, automated security testing and cloud-native security controls.
π Next Module
Section titled βπ Next Moduleββ‘οΈ Module 12 β AWS Security Architecture
In the next module, you will design secure enterprise AWS architectures covering:
- AWS Well-Architected Framework
- Secure Multi-Account Architecture
- Landing Zones
- Network Segmentation
- Identity Federation
- Zero Trust Architecture
- Hybrid Cloud Security
- High Availability & Resiliency
- Secure Application Architecture
- Enterprise Security Design Patterns
- Security Governance at Scale
- End-to-End Enterprise AWS Security Architecture