Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit a727dca

Browse files
committed
fix(aws): 解决aws国际区账号有代理的时候获取不到区域的问题
1 parent 26bc6d2 commit a727dca

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

backend/src/main/java/io/riskscanner/commons/utils/PlatformUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,9 @@ public static final JSONArray _getRegions(AccountWithBLOBs account, Proxy proxy,
367367
}
368368
switch (account.getPluginId()) {
369369
case aws:
370-
AWSCredential awsCredential = new Gson().fromJson(account.getCredential(), AWSCredential.class);
371-
AmazonEC2Client client = new AmazonEC2Client(new BasicAWSCredentials(awsCredential.getAccessKey(), awsCredential.getSecretKey()));
370+
AWSRequest awsReq = new AWSRequest();
371+
awsReq.setCredential(account.getCredential());
372+
AmazonEC2Client client = awsReq.getAmazonEC2Client(proxy);
372373
DescribeRegionsResult result;
373374
try {
374375
client.setRegion(RegionUtils.getRegion("cn-north-1"));

0 commit comments

Comments
 (0)