You are on page 1of 46

D1DEV102

End-to-End CI/CD at scale with


Infrastructure-as-Code on AWS

Bhuvaneswari Subramani (she/hers)


Director, Engineering Operations, Infor
AWS DevTools Hero

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Quick Intro

• Bhuvaneswari Subramani (Bhuvana)


• Director, Engineering Operations, Infor
• AWS Hero since 2019
• Organizer, AWS User Group Bengaluru
• Leading cloud computing, DevOps,
and Performance QA
/bhuvanas

@installjournal

https://bhuvana.pro

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda

• Why Infrastructure as Code (IaC) for CI CD ?

• CI CD multi-account Architecture

• Build & Deployment Infrastructure Setup

• Best Practices

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why Infrastructure as Code
for CI CD ?

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Key Benefits

Speed Consistency Traceability

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CI CD with multi-account
architecture

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration
Developer Service Account
AWS Cloud

VPC Gateway
VPC
EndPoint

Private subnet
Lin 1

3
1 - Initiate Build process
2 Worker Nodes
Build & Deploy 2 - Get Source code
Server
CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration
Developer Service Account
AWS Cloud
4 Publish build
artifacts

VPC Gateway S3 Buckets


VPC
EndPoint

Private subnet
Lin 1

3
1 - Initiate Build process
2 Worker Nodes
Build & Deploy 2 - Get Source code
Server
CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration
Developer Service Account
AWS Cloud
4 Publish build
artifacts

VPC Gateway S3 Buckets


VPC
EndPoint

Private subnet
Lin 1

3
1 - Initiate Build process
2 Worker Nodes
Build & Deploy 2 - Get Source code
5 Server
CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration
Developer Service Account
AWS Cloud
4 Publish build
artifacts

VPC Gateway S3 Buckets


VPC
EndPoint

Private subnet
App artifacts
Lin 1

3
Config artifacts
2 Worker Nodes
Build & Deploy
5 Server
Data system artifacts

Mirror Git
Repo Test artifacts

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Deployment – Nano Env Users
https://<env-id>.nano.infornexus.com

Developer Service Account Nano Environment(s) Account


AWS Cloud AWS Cloud

Availability Zone
S3 Buckets

VPC VPC
Internet gateway

Private subnet Public Subnet


Deploy

Lin

Build & Deploy Windows Linux


Server
Peer Peer

Mirror Git
Repo

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Nano to Full Scale Environments

Beta

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration – Alpha / Beta / Prod Env
Developer Service Account
AWS Cloud

VPC

Private subnet
Lin 1

3
1 - Initiate Build process
2 Worker Nodes
Build Server 2 - Get Source code

CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration – Alpha / Beta / Prod Env
Developer Service Account
AWS Cloud
4 Publish build
artifacts

VPC Gateway S3 Buckets


VPC
EndPoint

Private subnet
Lin 1

3
1 - Initiate Build process
2 Worker Nodes
Build Server 2 - Get Source code

CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Integration – Alpha / Beta / Prod Env
Developer Service Account
AWS Cloud
4 Publish build
artifacts

4
VPC Gateway VPC Interface S3 Buckets
VPC
EndPoint EndPoint

Private subnet Publish container


images
Lin 1
ECR
3
1 - Initiate Build process
2 Worker Nodes
Build Server 2 - Get Source code

CI 3 - Compile & generate artifacts

4 - Publish artifacts
Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Deployment – Alpha / Beta / Prod Env
Developer Service Account Prod Account
AWS Cloud AWS Cloud
4 Publish build
artifacts

4
VPC Gateway VPC Interface S3 Buckets
VPC
EndPoint EndPoint

Private subnet Publish container


images
Lin 1
ECR
3
1 - Initiate Build process
2 Worker Nodes
Build Server 2 - Get Source code
5
CI 3 - Compile & generate artifacts

4 - Publish artifacts Deploy Server


Mirror Git
Repo
5 - Run code validation suite

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Deployment – Alpha / Beta / Prod Env
Developer Service Account Alpha / Beta / Prod Environment Account
AWS Cloud AWS Cloud
ECR
Publish build
artifacts
A

B Publish
VPC container VPC
images

Private subnet Private subnet


App Container Services

Logging & Monitoring


• Web Tier
• Integration Tier

Supply Chain Intelligence


Lin Intermediate Tier
Deploy Nodes
• Caching
Build Server • Lock co-ordination
• Service Discovery

Data Tier
• Queueing
Mirror Git Deploy Server • AWS Hosted Data Services
Repo • AWS Managed Data Services

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Deployment – Alpha / Beta / Prod Env
Developer Service Account Alpha / Beta / Prod Environment Account
AWS Cloud AWS Cloud
ECR
Publish build
artifacts
A

B Publish
VPC container VPC
images

Private subnet Private subnet


App Container Services

Logging & Monitoring


• Web Tier
• Integration Tier

Supply Chain Intelligence


Lin C Intermediate Tier
Deploy Nodes
• Caching
Build Server • Lock co-ordination
• Service Discovery

Data Tier
• Queueing
Mirror Git Deploy Server • AWS Hosted Data Services
Repo • AWS Managed Data Services

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Continuous Deployment – Alpha / Beta / Prod Env
Developer Service Account Alpha / Beta / Prod Environment Account
AWS Cloud AWS Cloud
ECR
Publish build
artifacts
A D
D
B Publish
VPC Gateway VPC Interface
VPC container VPC
EndPoint EndPoint
images

Private subnet Private subnet


App Container Services

Logging & Monitoring


• Web Tier
• Integration Tier

Supply Chain Intelligence


Lin C Intermediate Tier
Deploy Nodes
• Caching
Build Server • Lock co-ordination
• Service Discovery

Data Tier
• Queueing
Mirror Git Deploy Server • AWS Hosted Data Services
Repo • AWS Managed Data Services

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build & Deployment
Infrastructure Setup

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build Infrastructure Components

IAM Roles
S3 Bucket Mirror Git Repo VPC EndPoints

Secrets
AWS
CloudFormation

Jenkins Win Jenkins Linux ECR


Agent Agent Jenkins Master
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup Mirror Git Repo using IaC
Create Git repo tar.gz &
Upload to S3

Create EC2 Instance

AWS Mirror Git Repo


CloudFormation Pull Git repo tar.gz from
S3 and place in EC2

Configure Cron job to


sync Git repo
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup Jenkins Master using IaC

Pipeline

IaC Developers

Linux Agent
Bootstrap
Jenkins
Gitlab Source - IaC Create Salt Jenkins
EC2 minion Jenkins Job
Server Configuration

Windows Agent
Source - Bootstrap

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dev Environment for Jenkins Bootstrapping
Run Jenkins as Container
Install Docker

Setup local repo

Bind mount the directories into


Docker Containers

Install Jenkins as a Container

Configure Jenkins
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best Practices

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Best Practices
• Operational excellence

• Security

• Reliability

• Performance efficiency

• Cost optimization AWS Well-Architected Framework

• Sustainability
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Operational excellence

• Continually improving quality process

• Design for failure

• Opportunities for improvement

• Clearly defined Promotion model for IaC

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Operational Excellence – Promotion Model
• Holds IaC for services that are live on an Env
Stable • Protected Branch ; Changes needs approval

• Holds IaC for services ready to go live


Staging • Protected Branch ; Changes needs approval

• To apply changes to production or


Feature alpha branch

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Operational Excellence – Promotion Model
{Promote to Stable for
go live}
[STAGING]

[FEATURE-1]
{Create} {rebase} {promote}
[ … ]
[FEATURE-N] {Create}

Conventions
o commit
+ branch create
* rebase
^ promote
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. \/ code flow
[ ] branch
Operational Excellence – Promotion Model
{Promote to Stable for
go live}
[STAGING]

[FEATURE-1]
{Create} {rebase} {promote}
[ … ]
[FEATURE-N] {Create}

[STABLE]
{Code flow to Staging}

[FEATURE-1]{Create} {rebase} {promote}


Conventions
[ … ] o commit
[FEATURE-N] + branch create
{Create} * rebase
^ promote
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved. \/ code flow
[ ] branch
Security

• Infrastructure protection

• Centralized identities with SAML 2.0

• End-to-end Traceability

• Data Protection

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Reliability

• Monitor workload Resources

• Adapt to changes in Demand

• Implement resiliency for reliable workload

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Performance Efficiency

• Capability to deploy the workload in multiple

AWS Regions

• Use serverless architectures

• Monitor your resources

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Cost Optimization

• Implement cloud financial management

• Monitor Cost and Usage

• Stop spending money on undifferentiated

heavy lifting

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Sustainability

• Remove or refactor workload components with

low or no use

• Increase utilization of build environments

• Optimize areas of code that consume the most

time or resources

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Key Benefits

Speed Consistency Traceability

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Resources
https://aws.amazon.com/devops/
DevOps and AWS

https://docs.aws.amazon.com/whitepapers/latest/introduction-devops-
aws/infrastructure-as-code.html
AWS Infrastructure as Code

https://aws.amazon.com/architecture/well-architected/
AWS Well Architected Framework

https://aws.amazon.com/developer/community/heroes
AWS Heroes

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Learn in-demand AWS Cloud skills

AWS Skill Builder AWS Certifications


Access 500+ free digital courses Earn an industry-recognized
and Learning Plans credential

Explore resources with a variety Receive Foundational,


of skill levels and 16+ languages Associate, Professional,
to meet your learning needs and Specialty certifications

Deepen your skills with digital Join the AWS Certified community
learning on demand and get exclusive benefits

Access new
Train now exam guides

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you!
Bhuvaneswari Subramani

/bhuvanas

@installjournal
https://bhuvana.pro

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
!
Please complete
the session survey

© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.

You might also like