AWS Builder Center
InfraShift: Predicting the Cloud Impact of Code Changes Before Deployment

InfraShift: Predicting the Cloud Impact of Code Changes Before Deployment

Building an AWS-powered system that connects code changes to infrastructure, cost, performance, and deployment outcomes Every software deployment begins with a change. A developer modifies a Lambda function. An API endpoint is added. A DynamoDB query changes. A dependency becomes heavier. A configuration value changes. From a code-review perspective, these may look like relatively small changes. But in a cloud environment, a small code change can have a much larger operational effect.



1. The Problem

Traditional code review answers questions such as:
  • Does the code compile?
  • Are the tests passing?
  • Does the implementation follow our coding standards?
  • Does the change introduce an obvious bug?
Cloud monitoring answers different questions:
  • How much CPU or memory is being consumed?
  • How long are Lambda invocations taking?
  • How many API requests are arriving?
  • How much is the workload costing?
  • Are error rates increasing?
  • What happened after deployment?
The problem is that these two worlds are often separated.
A developer reviews a pull request first.
The infrastructure impact becomes visible later.
For example, imagine a Lambda function originally performs:
API Gateway
↓
Lambda
↓
DynamoDB
A developer changes a DynamoDB access pattern.
The code review may look perfectly reasonable.
But the production consequences could include:
More DynamoDB requests
↓
More Lambda execution time
↓
Higher Lambda duration
↓
Higher request cost
↓
Higher end-to-end latency
The developer shouldn't have to wait for production telemetry to discover this.
We wanted to move part of that analysis before deployment.



2. The Idea Behind InfraShift

InfraShift takes a code change and attempts to answer:
What could this change do to the cloud workload if we deploy it?
The system follows a pipeline:
Code Change / Pull Request
↓
Change Analysis
↓
Infrastructure Mapping
↓
Historical / Baseline Telemetry
↓
Impact Forecasting
↙ ↘
Cost Performance
↘ ↙
Evidence
↓
Recommendation
↓
Controlled Test
↓
Actual Telemetry
↓
Forecast vs Reality
The important part is that InfraShift does not stop at generating a prediction.
It also provides:
  • evidence behind the prediction
  • confidence
  • recommendations
  • controlled testing
  • and an outcome comparison between prediction and reality
This creates a feedback loop.



3. The Architecture

Our initial demonstration workload is intentionally small:
┌───────────────────┐
│ GitHub PR │
│ / Code Change │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ InfraShift │
│ Analysis │
└─────────┬─────────┘
│
┌─────────▼─────────┐
│ Infrastructure │
│ Impact Mapping │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Historical AWS │
│ Telemetry │
└─────────┬─────────┘
│
┌────────────┴────────────┐
▼ ▼
┌────────────────┐ ┌────────────────┐
│ Cost Forecast │ │ Performance │
│ │ │ Forecast │
└────────┬───────┘ └───────┬────────┘
│ │
└───────────┬────────────┘
▼
┌───────────────────┐
│ Evidence & │
│ Recommendations │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Controlled Test │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Actual AWS │
│ Telemetry │
└─────────┬─────────┘
│
▼
┌───────────────────┐
│ Forecast vs │
│ Actual Outcome │
└───────────────────┘
The demo workload uses:
  • Amazon API Gateway
  • AWS Lambda
  • Amazon DynamoDB
  • Amazon CloudWatch
  • AWS X-Ray
  • AWS IAM
  • AWS CloudFormation
Additional AWS services can be incorporated as the system evolves.



4. Why We Chose a Small AWS Workload

One of the biggest design decisions was not to start by building a huge cloud platform.
Instead, we created a controlled workload around one simple architecture:
API Gateway → Lambda → DynamoDB
│
├── CloudWatch
└── X-Ray
This gives us a useful but manageable environment.
For example:

API Gateway

Provides the public HTTP entry point.

Lambda

Runs the application logic.

DynamoDB

Provides persistent application data.

CloudWatch

Provides operational telemetry.

X-Ray

Provides additional tracing information.
This is enough to demonstrate the complete InfraShift lifecycle without introducing unnecessary infrastructure complexity.



5. Infrastructure as Code

We use AWS CloudFormation/SAM to define the demo workload.
The important principle is:
The infrastructure used for the demonstration should itself be reproducible.
Instead of manually creating every AWS resource, the infrastructure is described in a template.
The template defines resources such as:
API Gateway
Lambda
DynamoDB
CloudWatch Log Group
Telemetry IAM Role
This makes the environment easier to:
  • recreate
  • inspect
  • test
  • clean up
  • demonstrate
It also allows the InfraShift workflow to reason about infrastructure in a structured way.



6. Handling an Existing Lambda IAM Role

During development we encountered a practical AWS infrastructure issue.
The Lambda execution role had already been created:
InfraShiftDemoLambdaRole
CloudFormation originally attempted to create the same role.
That created a resource ownership conflict.
Instead of creating another role, we changed the CloudFormation template to accept an existing role ARN:
Parameters:
LambdaExecutionRoleArn:
Type: String
Default: arn:aws:iam::425746683169:role/InfraShiftDemoLambdaRole
The Lambda resource then references:
Role: !Ref LambdaExecutionRoleArn
This is a useful infrastructure pattern when a resource already exists outside the current CloudFormation stack.
It also prevents the stack from trying to recreate an IAM role that is already managed elsewhere.



7. IAM: Least Privilege Matters

AWS automation needs permissions.
But giving the deployment user full administrator permissions would make the system easier to configure at the expense of security.
We therefore created a dedicated deployment policy.
The policy is scoped around the resources and operations InfraShift needs.
For example, the policy contains permissions for:
CloudFormation
Lambda
API Gateway
DynamoDB
CloudWatch
CloudWatch Logs
X-Ray
IAM role operations
IAM role passing is restricted to the specific InfraShift roles rather than allowing unrestricted role passing.
This matters because infrastructure automation can become a powerful privilege boundary.
A useful rule we followed was:
Give the deployment process enough permissions to perform its job, but don't turn the deployment identity into an administrator.



8. A Real-World AWS Lesson: CloudFormation Tagging Permissions

One of the most valuable lessons during development came from an actual deployment failure.
CloudFormation attempted to create:
InfraShiftBackendTelemetryRole
The operation failed because the deployment identity didn't have:
iam:TagRole
The CloudFormation stack therefore entered:
ROLLBACK_COMPLETE
The lesson was important.
It wasn't enough to think:
"CloudFormation can create the IAM role."
CloudFormation was also applying stack-level tags to resources.
Therefore the deployment identity needed permission to perform the corresponding IAM tagging operation.
We added:
iam:TagRole
iam:UntagRole
to the narrowly scoped IAM role-management permissions.
This is a good example of why infrastructure automation should be tested against real AWS APIs rather than assuming that a theoretically complete permission list will work.



9. Connecting Code to Infrastructure

The core InfraShift problem isn't simply forecasting metrics.
It is first determining:
Which cloud resources are actually affected by this code change?
For example, a pull request might modify a Lambda handler.
InfraShift can associate that change with:
Lambda function
↓
DynamoDB access
↓
API Gateway request path
↓
CloudWatch telemetry
This creates an impact graph.
A conceptual graph looks like:
API Gateway
│
▼
Lambda
/ \
/ \
▼ ▼
DynamoDB CloudWatch
│
▼
Metrics
The graph provides context for the forecasting system.
Instead of asking:
"What will this code do?"
InfraShift can ask:
"What will this code change do to the specific cloud resources it interacts with?"



10. Historical Telemetry as the Baseline

Forecasting without a baseline is difficult.
InfraShift therefore uses historical or baseline telemetry where available.
For the AWS workload, CloudWatch becomes an important source of operational evidence.
Examples of useful signals include:
  • invocation count
  • duration
  • errors
  • throttles
  • request activity
  • resource utilization
  • workload trends
The system uses the observed baseline to establish what normal behavior looks like.
Conceptually:
Historical Workload
↓
Baseline
↓
Expected behavior
+
Code Change
↓
Forecast
This is more useful than producing a prediction without showing where it came from.



11. Cost Forecasting

One of InfraShift's goals is to estimate how a proposed change could affect cloud cost.
The system can combine workload behavior with AWS pricing-related signals and usage assumptions.
A simplified example:
Current Lambda duration:
100 ms

Predicted duration:
130 ms

Expected increase:
30%
If invocation volume remains approximately constant, increased execution duration can become an input into the cost analysis.
The same concept applies to downstream services.
The goal isn't to claim that a forecast is an exact AWS bill.
Instead, InfraShift presents a forecast with:
  • metric
  • baseline
  • predicted value
  • supporting evidence
  • confidence
  • assumptions
That distinction is important.
A forecast is an estimate, not a billing statement.



12. Performance Forecasting

Cost isn't the only concern.
A change can be financially inexpensive but operationally harmful.
For example:
Database access increases
↓
Lambda duration increases
↓
API latency increases
InfraShift therefore looks at performance/resource metrics as well.
A forecast can answer questions such as:
  • Could Lambda duration increase?
  • Could request latency increase?
  • Could resource consumption change?
  • Could error behavior change?
The result can be displayed alongside the cost forecast.
This gives developers two complementary perspectives:
Financial Impact
+
Operational Impact



13. Evidence and Confidence

A prediction without explanation isn't particularly useful to a developer.
InfraShift therefore includes an evidence layer.
Instead of:
"Latency will increase by 18%."
the system aims to provide something closer to:
Predicted latency increase: 18%

Evidence:
• Historical Lambda duration
• Recent request volume
• Changed database access pattern
• Baseline workload behavior

Confidence: 87%
The exact confidence value is part of the model output and should be interpreted in the context of the available evidence.
This creates a much more transparent forecasting experience.



14. Why This Forecast?

One of the product screens is specifically designed around the question:
Why should I believe this forecast?
The answer is broken into evidence.
For example:
WHY THIS FORECAST?

1. Baseline
Average Lambda duration over the selected period.

2. Code change
Database access behavior changed.

3. Historical relationship
Similar workload increases were associated
with increased execution duration.

4. Forecast
Expected resource impact is above baseline.

5. Confidence
Confidence reflects the available evidence.
This is important for developer trust.
We don't want InfraShift to become another black-box AI tool that simply outputs a number.



15. Recommendations

After generating a forecast, InfraShift can provide an actionable recommendation.
The purpose isn't simply to say:
"This might cost more."
The system should help answer:
"What should I investigate before deployment?"
For example:
Potential database access increase detected.

Suggested actions:
• Review DynamoDB access pattern.
• Check query frequency.
• Compare expected request volume.
• Run the controlled test before production deployment.
Recommendations are therefore tied to the detected impact rather than being generic optimization advice.



16. Controlled Testing

Prediction alone isn't enough.
The strongest part of the InfraShift workflow is the ability to compare:
Predicted behavior
vs
Actual behavior
But testing must be controlled.
The system therefore treats deployment/testing as a sandbox or controlled environment rather than immediately modifying production.
The workflow becomes:
PR
↓
Analyze
↓
Forecast
↓
Recommendation
↓
Controlled Test
↓
Collect Telemetry
↓
Compare
This creates an important feedback loop.



17. Forecast vs Actual

After the controlled test, InfraShift can compare its prediction with the observed telemetry.
Conceptually:
BEFORE TEST
│
▼
Forecast
│
│
▼
Controlled Test
│
▼
Actual Metrics
│
┌────────┴────────┐
▼ ▼
Forecast Actual
Duration Duration
│ │
└────────┬────────┘
▼
Comparison
This allows the system to answer:
How close was the forecast to reality?
This is also how the forecasting system can become more useful over time.



18. The Frontend

InfraShift uses a React + TypeScript + Vite frontend.
The UI is organized around the lifecycle of a cloud-impact analysis.
The major screens include:

Dashboard

Provides a high-level view of projects and analyses.

PR Analysis

Shows the proposed code change and its interpretation.

Impact Graph

Shows the relationship between code and cloud resources.

Cost Forecast

Displays projected financial impact.

Performance Forecast

Displays projected operational/resource impact.

Evidence

Shows the supporting signals behind the forecast.

Recommendations

Provides suggested next steps.

Outcome

Compares forecast with actual results.

History

Provides previous analyses.

Settings

Contains application configuration.
The intention is to make the workflow understandable to both developers and cloud engineers.



19. The Backend

The backend is implemented using FastAPI.
It exposes APIs for the frontend and the InfraShift analysis workflow.
Examples include endpoints for:
Projects
Analyses
Impact
Forecast
Evidence
Recommendations
Outcome
Telemetry
PR information
Controlled testing
A simplified API flow looks like:
React Frontend
│
▼
FastAPI
│
├── Analysis
├── Forecasting
├── Telemetry
├── Recommendations
└── Outcome
This separation keeps the frontend focused on visualization while the backend handles orchestration and analysis.



20. Testing the System

A cloud-impact platform cannot rely only on manual testing.
We built tests around the backend and AWS-related functionality.
The local test suite covers areas such as:
  • API behavior
  • forecasting
  • telemetry
  • AWS integrations
  • analysis workflow
  • recommendations
  • controlled test behavior
We also use mocked AWS services for offline testing where appropriate.
This gives us two useful modes:
Local / Mocked AWS
↓
Fast development and testing

Real AWS
↓
Integration validation and demonstration
This distinction is important because mocked AWS behavior should never be presented as real production telemetry.



21. Keeping Mock Data Honest

One design principle we considered important was not confusing simulated data with real AWS data.
During local development, the system can operate with offline/mock telemetry.
But the UI should make that distinction clear.
Conceptually:
MOCK_DATA_LOCAL_DEV
should never be silently presented as:
LIVE AWS TELEMETRY
When real AWS telemetry is available, the system should identify it as such.
This makes the demo more credible and prevents misleading conclusions.



22. AWS Security Considerations

InfraShift deals with cloud infrastructure, so security is part of the architecture rather than an afterthought.
Important principles include:

No credentials in source code

AWS credentials should never be committed to GitHub.

IAM roles for AWS workloads

Lambda should use an IAM execution role rather than embedded AWS access keys.

Least privilege

Deployment permissions should be scoped.

Controlled testing

Testing should happen in an isolated or designated environment.

Explicit telemetry source

The application should distinguish real telemetry from development fallback data.

Infrastructure cleanup

Failed CloudFormation deployments can leave orphaned resources, so cleanup and verification are part of the development workflow.



23. What We Learned While Building It

The most interesting lessons weren't all about writing application code.
Several came directly from working with AWS.

Lesson 1: A small code change can have a large infrastructure context

The relationship between source code and cloud resources is often indirect.
That's exactly why an impact graph is useful.



Lesson 2: Forecasts need evidence

A prediction becomes much more useful when developers can understand:
What was observed?
What changed?
What was predicted?
How confident is the system?



Lesson 3: CloudFormation permissions can be subtle

Creating a resource isn't always the only operation CloudFormation performs.
Stack tags, role passing, resource inspection, and cleanup can require additional permissions.
Real AWS testing exposed this much faster than purely local testing would.



Lesson 4: Least privilege takes iteration

It is tempting to solve AWS permission errors with:
AdministratorAccess
But that hides the actual permission requirements.
A better approach is:
Deployment fails
↓
Identify exact AWS action
↓
Add narrowly scoped permission
↓
Retry
This produces a more defensible security model.



Lesson 5: Cleanup is part of deployment engineering

A failed stack can leave resources behind.
For example, during development we encountered an API Gateway resource that remained after a failed CloudFormation operation.
We explicitly checked for and removed the orphaned resource before attempting another deployment.
Infrastructure automation therefore needs both:
Create
+
Verify
+
Cleanup



24. Why InfraShift Is Different

There are many cloud monitoring systems.
There are many cost dashboards.
There are many CI/CD systems.
There are also many AI coding assistants.
InfraShift focuses on the connection between them.
The central workflow is:
CODE CHANGE
↓
INFRASTRUCTURE IMPACT
↓
HISTORICAL EVIDENCE
↓
COST + PERFORMANCE FORECAST
↓
RECOMMENDATION
↓
CONTROLLED TEST
↓
ACTUAL OUTCOME
The goal is to shift cloud-impact awareness left in the development lifecycle.
Instead of:
Deploy → Monitor → Discover Problem
we want:
Analyze → Forecast → Test → Deploy



25. Future Improvements

The current implementation is intentionally focused on an end-to-end MVP.
There are several directions we can take it next.

More AWS resource types

Extend infrastructure mapping to services such as:
  • ECS
  • RDS
  • S3
  • SQS
  • SNS
  • Step Functions

Better cost modeling

Integrate additional AWS billing and usage signals.

More advanced forecasting

Use longer historical windows and more workload features.

Better code-to-resource mapping

Improve identification of which cloud resources are affected by a specific source-code change.

Automated PR integration

A future version could automatically comment on GitHub pull requests with:
Potential impact detected

Cost:
↑ estimated

Performance:
↑ estimated

Confidence:
...

Evidence:
...

Continuous learning

After every controlled test:
Forecast
↓
Actual
↓
Error
↓
Model improvement
The system could gradually improve its forecasts based on observed outcomes.



26. The Bigger Vision

Cloud infrastructure has become programmable.
That means developers can change infrastructure behavior through code at an incredible speed.
But our understanding of the consequences has not always kept pace.
InfraShift explores a different model:
Treat cloud impact as part of the code-review process.
Before a developer merges a change, they should be able to understand:
  • Which cloud resources are affected?
  • What happened historically?
  • What could change?
  • What could it cost?
  • What performance impact could occur?
  • What evidence supports that prediction?
  • How confident is the forecast?
  • What should be tested?
  • What actually happened after the test?
That is the workflow InfraShift is designed to provide.



Conclusion

InfraShift started from a simple observation:
Cloud impact shouldn't be something developers discover only after deployment.
By connecting code changes to AWS resources, historical telemetry, forecasting, evidence, recommendations, and controlled testing, InfraShift creates a path toward more informed cloud deployments.
The architecture is intentionally built around AWS services that developers already use:
GitHub
↓
InfraShift
↓
API Gateway
↓
Lambda
↓
DynamoDB
↓
CloudWatch / X-Ray
The final goal is not to replace developers or cloud engineers.
It is to give them better information before a change reaches production.
Before you deploy the code, know what it could do to your cloud.



AWS Services Used

AWS Service
Role in InfraShift
AWS Lambda
Executes the demonstration application
Amazon API Gateway
Provides the HTTP API entry point
Amazon DynamoDB
Provides application persistence
Amazon CloudWatch
Provides operational telemetry
AWS X-Ray
Provides tracing information
AWS IAM
Controls access and workload roles
AWS CloudFormation / SAM
Defines and deploys infrastructure
AWS Cost Explorer
Potential cost-analysis integration
Amazon Bedrock
Potential AI/LLM integration for future analysis



Project Stack

Frontend
  • React
  • TypeScript
  • Vite
Backend
  • Python
  • FastAPI
  • boto3
Cloud
  • AWS Lambda
  • API Gateway
  • DynamoDB
  • CloudWatch
  • X-Ray
  • IAM
  • CloudFormation/SAM
Development
  • GitHub
  • Automated tests
  • AWS mocked/local development where appropriate
  • AI-assisted development



Acknowledgments

InfraShift was built as an AWS-focused hackathon project. The implementation uses AWS services and open-source development tools as permitted by the hackathon rules.
The project was developed with AI coding assistance, including OpenAI/ChatGPT and Antigravity, alongside conventional development, testing, and AWS validation.

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article