我已经在Redshift中创建了外部架构和外部表。我可以使用\ dn在postgresql中查看外部架构名称。
将执行什么查询,以便我可以在Java中运行它?以及查询以获取外部表的列表?
我试过了
select * from information_schema.tables where
table_schema not in ('pg_catalog', 'information_schema')
and table_schema not like 'pg_toast%'
Run Code Online (Sandbox Code Playgroud)
但它没有获取外部表的列表。
我正在尝试生成临时凭证访问密钥和秘密密钥。我用过承担角色。描述说它生成访问密钥和秘密密钥。但是GetSessionTokenResult也可以生成访问密钥和秘密密钥。那么,假设角色的用途是什么?
AWSSecurityTokenService awsSecurityTokenService =
AWSSecurityTokenServiceClientBuilder
.standard().withCredentials(new ProfileCredentialsProvider())
.withRegion(region).build();
AssumeRoleRequest assumeRoleRequest = new AssumeRoleRequest()
.withRoleArn(
"arn:aws:iam::account-id:role/p-27c229ade194_ec2")
.withRoleSessionName("RedshiftSession");
AssumeRoleResult assumeRoleResult = awsSecurityTokenService
.assumeRole(assumeRoleRequest);
GetSessionTokenRequest getSessionTokenRequest = new GetSessionTokenRequest();
getSessionTokenRequest.setDurationSeconds(1200);
GetSessionTokenResult getSessionTokenResult = awsSecurityTokenService
.getSessionToken(getSessionTokenRequest);
Credentials sessionCredentials = getSessionTokenResult.getCredentials();
final String adminAccessKeyId = sessionCredentials.getAccessKeyId();
final String adminAccessSecretKey = sessionCredentials
.getSecretAccessKey();
Run Code Online (Sandbox Code Playgroud)
较早之前使用假定角色,它显示错误=> aws:iam :: user / admin在资源角色aws:iam :: role / role_id上不是sts:assumeRole通过在role_id的受信任关系中添加aws:iam :: user / admin起作用。
如果我将注释掉AccessRole及其另一个调用的类。我可以生成访问密钥和秘密密钥。使用承担角色的目的是什么?