如何使用Java从AWS SSM参数存储中检索参数

时间:2018-09-25 04:54:22

标签: java aws-ssm-document

我有一个Java代码,可以使用IAM角色从AWS ssm参数存储中检索参数。这段代码抛出了一些HTTP错误。有人可以帮我吗?

package com.au.local.sit.parquet.dbload;

import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement;
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClientBuilder;
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterRequest;
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterResult;

public class GetPasswordParameter {

    public static void main(String args[]) {
        final AWSSimpleSystemsManagement client=AWSSimpleSystemsManagementClientBuilder.defaultClient();
        GetParameterRequest request = new GetParameterRequest();
        request.withName("/asset/DB").withWithDecryption(true);
         GetParameterResult result = client.getParameter(request);
        System.out.println(result.getParameter().getValue());
    }

}

0 个答案:

没有答案