How do you test boto3-heavy AWS tools without calling real services?

0
0
Asked By MellowQuasar42 On

I'm building a tool that scans a live AWS account for misconfigurations. The detection logic is manageable, but testing is difficult: I want to avoid constantly calling real AWS services in CI, while also avoiding so much mocking that the tests stop being meaningful. I use moto for simpler cases, but some checks involve interactions across multiple services—for example, comparing an EC2 instance's security group configuration with its actual exposed ports. What approaches have worked well for you: moto, LocalStack, a disposable AWS account, record-and-replay tools, or something else?

3 Answers

Answered By NorthstarMango8 On

It may also be worth looking at existing AWS security-auditing tools such as ScoutSuite. Even if you don’t use it directly, its implementation and test patterns could provide ideas—or you might be able to extend it instead of building every check from scratch.

Answered By VelvetOrbit3 On

For cases where setting up a realistic environment is difficult, a record-and-replay approach can be useful. Tools such as placebo can capture boto3 interactions and replay them in tests, giving you stable fixtures based on real responses without making AWS calls every time.

Answered By CedarFox7 On

A combination tends to work best. Use mocks for unit tests, then run integration tests against LocalStack or a separate development environment for workflows that span multiple AWS services. That keeps CI fast without relying entirely on unrealistic mocks.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.