如何在Jenkins中设置AWS凭证?

时间:2019-08-08 10:46:10

标签: java linux amazon-web-services docker jenkins

我正在尝试从下面的代码读取一个表,该表在Windows中工作正常,但是当我在Jenkins docker容器中运行它时,出现以下错误。

我的阅读发电机tb的代码如下-

 AmazonDynamoDB ClientObj = AmazonDynamoDBClientBuilder.standard().withRegion("xx-xxxx-1").build();
        DynamoDB dynamoDB = new DynamoDB(ClientObj);
        Table table = dynamoDB.getTable("xxxxxx");
        String app_type = "xxxxxx";
        String MSG_Id = Res_ID;
        GetItemSpec spec = new GetItemSpec().withPrimaryKey("app_type", app_type, "messageID", MSG_Id);
        try {
            log.log(LogStatus.INFO, "Attempting to read the item...");
            Item outcome = table.getItem(spec);
            log.log(LogStatus.INFO, "GetItem succeeded: " + outcome);
  

无法从链中的任何提供商加载AWS凭证:   [EnvironmentVariableCredentialsProvider:无法加载AWS   来自环境变量(AWS_ACCESS_KEY_ID(或   AWS_ACCESS_KEY)和AWS_SECRET_KEY(或AWS_SECRET_ACCESS_KEY)),   SystemPropertiesCredentialsProvider:无法加载AWS凭证   来自Java系统属性(aws.accessKeyId和aws.secretKey),   com.amazonaws.auth.profile.ProfileCredentialsProvider@422b3532:   [aws_access_key_id]的属性值重复。   com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@5d6916d4:   无法从服务端点加载凭据]

0 个答案:

没有答案