Lambda超时中的AWS Java SDK STS

时间:2018-02-22 09:39:49

标签: java amazon-web-services aws-lambda aws-java-sdk aws-sts

我希望通过Lambda中的AWS Security Token Service获取临时凭证,但它始终在cboBroker.RowSource = "" cboBroker.AddItem "<ALL>" Set rs = CurrentDb.OpenRecordset("SELECT...") Do While Not rs.EOF cboBroker.AddItem rs.Fields(0).Value rs.MoveNext Loop 处超时。

有人帮助我吗?

源代码:

AWSSecurityTokenServiceClientBuilder.standard().build()

错误讯息:

package example;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.securitytoken.AWSSecurityTokenService;
import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder;
import com.amazonaws.services.securitytoken.model.AssumeRoleRequest;
import com.amazonaws.services.securitytoken.model.AssumeRoleResult;

public class SecurityTokenService implements RequestHandler<Request, Credential> {

    public Credential handleRequest(Request request, Context context) {
        AssumeRoleRequest assumeRoleRequest = new AssumeRoleRequest()
                .withPolicy("arn:aws:iam::12345678900:policy/SomePolicy")
                .withDurationSeconds(900);

        AWSSecurityTokenService securityTokenService = AWSSecurityTokenServiceClientBuilder.standard().build();

        AssumeRoleResult assumeRoleResult = securityTokenService.assumeRole(assumeRoleRequest);

        return new Credential(assumeRoleResult.getCredentials());

    }

}

0 个答案:

没有答案