Closed solidstore closed 4 months ago
Hi @solidstore, thank you for taking the time to open this issue, my apologies for the delay in response. We really appreciate you providing a reproduction of the issue as it's a big help to our team. I've notified the team of this issue and will update here as more information is available.
Driver version
2.1.1
Redshift version
N/A
Client Operating System
Windows
Table schema
N/A
Problem description
Support for IAM Instance Profile. I'm trying to use the Auth Type: "AWS Profile" and "Use Instance Profile" to pick the EC2 instance role.
Expected behaviour: The EC2 instance profile should be used for credentials.
Actual behaviour: Connection fails with error message.
Error message/stack trace:
Connection failed[HY000]: [Redshift][ODBC Driver][Server][860:8:IAMConnectionError]: Failed to get serverless credentials due to AWSCredentialsProvider being NULL.
ODBC trace logs
[DEBUG] 2024-04-08 07:18:10.084 [IAMHLP:RsIamHelper.cpp:299] [83460] RsIamHelper::SetIamSettings [DEBUG] 2024-04-08 07:18:10.084 [IAMHLP:RsIamHelper.cpp:350] [83460] Code flow for regular serverless cluster [DEBUG] 2024-04-08 07:18:10.084 [IAMHLP:RsIamHelper.cpp:393] [83460] Cluster Identifier: [DEBUG] 2024-04-08 07:18:10.084 [IAMCLNT:RsIamClient.cpp:65] [83460] RsIamClient::RsIamClient [DEBUG] 2024-04-08 07:18:10.086 [IAMCLNT:RsIamClient.cpp:107] [83460] RsIamClient::Connect [DEBUG] 2024-04-08 07:18:10.086 [IAMCLNT:RsIamClient.cpp:858] [83460] RsIamClient::ValidateConnectionAttributes [DEBUG] 2024-04-08 07:18:10.086 [IAMCLNT:RsIamClient.cpp:114] [83460] RsIamClient::Connect IAM AuthType: InstanceProfile [DEBUG] 2024-04-08 07:18:10.086 [IAMCLNT:RsIamClient.cpp:845] [83460] RsIamClient::GetServerlessCredentials [DEBUG] 2024-04-08 07:18:10.086 [IAMCLNT:RsIamClient.cpp:214] [83460] RsIamClient::~RsIamClient [DEBUG] 2024-04-08 07:18:10.087 [ODBCAPI:rstrace.h:96] [83460] SQLDriverConnectW() return SQL_ERROR SQLState:HY000 NativeCode:0 Error:[Redshift][ODBC Driver][Server][860:8:IAMConnectionError]: Failed to get serverless credentials due to AWSCredentialsProvider being NULL.
Reproduction code
Both the
IAMFactory::CreateDefaultCredentialsProvider
andIAMFactory::CreateInstanceProfileCredentialsProvider
methods appear to return NULL pointers. https://github.com/aws/amazon-redshift-odbc-driver/blob/main/src/odbc/rsodbc/iam/core/IAMFactory.cpp#L123