Hi, this one must be very easy but I am not able t...
# troubleshooting
r
Hi, this one must be very easy but I am not able to make it work. Using Flink 18 / Java 17, I am following the doc here to just read a file from a AWS S3 bucket. I first authenticate to S3 using
aws sso login --profile my-profile
Then I run from the IDE the code below
Copy code
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<String> ds = env.readTextFile("s3://mybucket/folder1/file.txt");
ds.print();
But I get this authentication error
Copy code
caused by: org.apache.hadoop.fs.s3a.auth.NoAuthWithAWSException: No AWS
Credentials provided by DynamicTemporaryAWSCredentialsProvider
TemporaryAWSCredentialsProvider SimpleAWSCredentialsProvider
EnvironmentVariableCredentialsProvider IAMInstanceCredentialsProvider :
com.amazonaws.SdkClientException: Unable to load AWS credentials from
environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and
AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY))
I have tried the different CredentialsProvider options suggested in the error message without success. Any idea of what could I be missing? Thanks for. your help,
j
I had the same issue when I get my login credentials via SSO. What works for me is exporting aws credentials as environment variables. I use aws2-warp and, once I run the following command, it'll export AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN variables.
Copy code
eval "$(aws2-wrap --profile <profile-name> --export)"
πŸ™Œ 1
r
Thanks, I will give it a try and report back.
It worked. Thanks again for the workaround.