elastic / elastic/cloudbeat

AWS multi region infrastructure improvements

Open
#787 3 comments 0 reactions 0 assignees View on GitHub
cloudbeat Team:Cloud Security
Dominant language
Go
Stars
58
Forks
55
Avg merge
9h 9m
Merged PRs (30d)
424

Description

**Background**
Today we use a multi-region wrapper to access AWS multi-regions with simple go functions, this implementation lies on the infrastructure and is being used by different fetchers and different use cases (vuln-mgm / cis_aws).

**Motivation**
We can improve the AWS multi-region infrastructure in a way that will let us consume it easily with more use cases.
One major issue is that by default we always initialize the multi-region map with all the regions while in vuln-mgmt we can only use the default region.
API example that will support the suggestions:

```go
type CrossRegionFactory[T any] interface {
NewMultiRegionClients(cfg awssdk.Config, factory func(cfg awssdk.Config) T, log *logp.Logger) CrossRegionFetcher[T]
WithDefaultRegion()
WithAllRegions(client DescribeCloudRegions)
}
```

Another suggestion I had, today, every time we use the multi-region provider we need to access its actual clients where instead I envision an implementation where the clients are private objects that should not be accessed directly.
API example that is taken from https://github.com/elastic/cloudbeat/pull/654/files#diff-286aa8e2b44cb12d1ca095e4ee878de54159f0973fe827bac1fa075ae5cc4179:

```go
type crossRegionProvider struct {
CrossRegionFetcher awslib.CrossRegionFetcher[ElasticCompute]
}

func (c *crossRegionProvider) DescribeNetworkAcl(ctx context.Context) ([]awslib.AwsResource, error) {
return c.CrossRegionFetcher.Fetch(func(ec ElasticCompute) ([]awslib.AwsResource, error) {
return ec.DescribeNetworkAcl(ctx)
})
}
```

Would like to hear your thoughts @uri-weisman @olegsu @jeniawhite

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.