Hi Team,
We am trying to create S3, SNS & Lambda client in Greengrass V2 custom components. As per documentation token exchange service should help with temporary credentials while building this clients. We were using AWS Java SDK V1, with following code base where functionalities are working fine and we were able to make AWS Services call.
AmazonS3 s3 = AmazonS3ClientBuilder.standard().withCredentials(new EC2ContainerCredentialsProviderWrapper())
.withRegion(Regions.US_WEST_2).build();
Now, we are in process of changing AWS Java SDK with V2, where "EC2ContainerCredentialsProviderWrapper" support is not there. So, we tried with "DefaultCredentialsProvider", also tried with direct client creation. But in all try, its not working. Moreover, aws.greengrass.TokenExchangeService is also considered in deployment, policy and roles are also properly configured, as it was working fine with AWS SDK Java V1.
-- with DefaultCredentialsProvider
SnsClient snsClient = SnsClient.builder().credentialsProvider(DefaultCredentialsProvider.create())
.region(Region.US_WEST_2).build();
-- Direct client building
SnsClient snsClient = SnsClient.builder().region(Region.US_WEST_2).build();
Could you please guide what are missing here, as we are getting error like as below
"Expected a profile or property definition on line 3"
Thanks,
NPatel
There are, that's what the error is complaining about.
~
is the home location for the user that your component is running as. This may be a different user than you are currently logged in as.There are no files on this location ... As I mentioned with V1 version its working fine but when we use V2 its giving this errors.
If you want to directly use only the correct credential provider, it is
ContainerCredentialsProvider
what location are you looking at? By default your component runs as ggc_user, which means you need to look at
/home/ggc_user/.aws
. If your component is running as root, it will be/root/.aws
it worked with v1 because you were not using the default chain which includes the profile credential provider.