我正在尝试使用BasicSessionCredentials连接到AWS S3,但是遇到类似Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: The AWS Access Key Id you provided does not exist in our records.
的异常
我正在使用 beam-sdks-java-io-amazon-web-services-2.13.0.jar 连接到S3。 以下是示例代码
BasicSessionCredentials sessionCredentials = new
BasicSessionCredentials(awsKeyId, awsSecretKey,sessionToken);
HadoopFileSystemOptions options =
PipelineOptionsFactory.as(HadoopFileSystemOptions.class);
options.as(AwsOptions.class).setAwsCredentialsProvider(new
AWSStaticCredentialsProvider(sessionCredentials));
options.as(AwsOptions.class).setRunner(SparkRunner.class);
options.as(AwsOptions.class).setAwsRegion("us-east-2");
Pipeline pipeline = Pipeline.create(options);
上面的代码正在抛出,
由于:java.io.IOException: com.amazonaws.services.s3.model.AmazonS3Exception:AWS访问密钥 您提供的ID在我们的记录中不存在。 (服务:Amazon S3; 状态码:403;错误代码:InvalidAccessKeyId;要求编号: 53876BU86ED7F1; S3扩展请求ID: bEV0s868U3kSCSVHaJjbuef97p98 / jksg3CC7UUUp1r3PNT7wPzbzPd1dn3yrfpAsYHMvp6NdWIY =), S3扩展请求ID: bEV0s868U3kSCSVHaJjbuef97p98 / jksg3CC7UUUp1r3PNT7wPzbzPd1dn3yrfpAsYHMvp6NdWIYJV = 在org.apache.beam.sdk.io.aws.s3.S3ReadableSeekableByteChannel.read(S3ReadableSeekableByteChannel.java:91) 在org.apache.beam.sdk.io.TextSource $ TextBasedReader.tryToEnsureNumberOfBytesInBuffer(TextSource.java:264) 在 org.apache.beam.sdk.io.TextSource $ TextBasedReader.findDelimiterBounds(TextSource.java:177) 在 org.apache.beam.sdk.io.TextSource $ TextBasedReader.startReading(TextSource.java:151) 在 org.apache.beam.sdk.io.FileBasedSource $ FileBasedReader.startImpl(FileBasedSource.java:476) 在 org.apache.beam.sdk.io.OffsetBasedSource $ OffsetBasedReader.start(OffsetBasedSource.java:249) 在 org.apache.beam.runners.spark.io.SourceRDD $ Bounded $ ReaderToIteratorAdapter.seekNext(SourceRDD.java:213) 在 org.apache.beam.runners.spark.io.SourceRDD $ Bounded $ ReaderToIteratorAdapter.tryProduceNext(SourceRDD.java:186) ...还有57个