Skip to content

Commit cfa631c

Browse files
authored
Merge pull request #87 from Cloud-Code-AI/86-bug-some-resources-are-not-accessible-in-other-regions-and-they-throw-error
fix: Separated global data and commented non us regions
2 parents 6351aca + 134823b commit cfa631c

File tree

2 files changed

+37
-34
lines changed

2 files changed

+37
-34
lines changed

go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ require (
1111
)
1212

1313
require (
14-
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.5 // indirect
15-
github.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.6 // indirect
16-
github.com/aws/aws-sdk-go-v2/service/codebuild v1.27.0 // indirect
17-
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6 // indirect
18-
github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.6 // indirect
14+
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.5
15+
github.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.6
16+
github.com/aws/aws-sdk-go-v2/service/codebuild v1.27.0
17+
github.com/aws/aws-sdk-go-v2/service/ecr v1.24.6
18+
github.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.6
1919
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.4 // indirect
20-
github.com/aws/aws-sdk-go-v2/service/kms v1.27.7 // indirect
21-
github.com/aws/aws-sdk-go-v2/service/route53domains v1.20.5 // indirect
20+
github.com/aws/aws-sdk-go-v2/service/kms v1.27.7
21+
github.com/aws/aws-sdk-go-v2/service/route53domains v1.20.5
2222
github.com/jmespath/go-jmespath v0.4.0 // indirect
2323
)
2424

services/awshandler/initialize.go

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,31 @@ import (
99

1010
// A function to get All the AWS regions
1111
func getAWSRegions() []string {
12+
// Currently supports US Only
1213
return []string{
13-
"us-east-2", // US East (Ohio)
14-
"us-east-1", // US East (N. Virginia)
15-
"us-west-1", // US West (N. California)
16-
"us-west-2", // US West (Oregon)
17-
"af-south-1", // Africa (Cape Town)
18-
"ap-east-1", // Asia Pacific (Hong Kong)
19-
"ap-south-1", // Asia Pacific (Mumbai)
20-
"ap-northeast-3", // Asia Pacific (Osaka)
21-
"ap-northeast-2", // Asia Pacific (Seoul)
22-
"ap-southeast-1", // Asia Pacific (Singapore)
23-
"ap-southeast-2", // Asia Pacific (Sydney)
24-
"ap-northeast-1", // Asia Pacific (Tokyo)
25-
"ca-central-1", // Canada (Central)
26-
"cn-north-1", // China (Beijing)
27-
"cn-northwest-1", // China (Ningxia)
28-
"eu-central-1", // Europe (Frankfurt)
29-
"eu-west-1", // Europe (Ireland)
30-
"eu-west-2", // Europe (London)
31-
"eu-south-1", // Europe (Milan)
32-
"eu-west-3", // Europe (Paris)
33-
"eu-north-1", // Europe (Stockholm)
34-
"me-south-1", // Middle East (Bahrain)
35-
"sa-east-1", // South America (São Paulo)
14+
"us-east-2", // US East (Ohio)
15+
"us-east-1", // US East (N. Virginia)
16+
"us-west-1", // US West (N. California)
17+
"us-west-2", // US West (Oregon)
18+
// "af-south-1", // Africa (Cape Town)
19+
// "ap-east-1", // Asia Pacific (Hong Kong)
20+
// "ap-south-1", // Asia Pacific (Mumbai)
21+
// "ap-northeast-3", // Asia Pacific (Osaka)
22+
// "ap-northeast-2", // Asia Pacific (Seoul)
23+
// "ap-southeast-1", // Asia Pacific (Singapore)
24+
// "ap-southeast-2", // Asia Pacific (Sydney)
25+
// "ap-northeast-1", // Asia Pacific (Tokyo)
26+
// "ca-central-1", // Canada (Central)
27+
// "cn-north-1", // China (Beijing)
28+
// "cn-northwest-1", // China (Ningxia)
29+
// "eu-central-1", // Europe (Frankfurt)
30+
// "eu-west-1", // Europe (Ireland)
31+
// "eu-west-2", // Europe (London)
32+
// "eu-south-1", // Europe (Milan)
33+
// "eu-west-3", // Europe (Paris)
34+
// "eu-north-1", // Europe (Stockholm)
35+
// "me-south-1", // Middle East (Bahrain)
36+
// "sa-east-1", // South America (São Paulo)
3637
}
3738
}
3839

@@ -68,8 +69,12 @@ func StoreAWSData(region string) {
6869
return
6970
}
7071
fmt.Printf("Storing data for region : %s\n", region)
71-
// Get all the S3 bucket data
72-
S3ListBucketss(sdkConfig, parentpath)
72+
73+
// Run this only once as they are global resource
74+
if region == "us-east-1" {
75+
S3ListBucketss(sdkConfig, parentpath)
76+
ListRoute53Func(sdkConfig, parentpath)
77+
}
7378
// Get all the lambda functions
7479
ListLambdaFns(sdkConfig, parentpath)
7580
// Get all dynamodb tables
@@ -82,8 +87,6 @@ func StoreAWSData(region string) {
8287
IamMetadata(sdkConfig, parentpath)
8388
// Get RDS Instance
8489
ListRDSFunc(sdkConfig, parentpath)
85-
// Get Route53 Info
86-
ListRoute53Func(sdkConfig, parentpath)
8790
// CloudFormation Stack
8891
CloudformationListFn(sdkConfig, parentpath)
8992
// Cloudwatch Data

0 commit comments

Comments
 (0)