I am trying to refresh cache on AWS FileGateway. I have built the AWSStorageGateway using AWSStorageGatewayClientBuilder object like this -
AWSStorageGateway awsStorageGateway = AWSStorageGatewayClientBuilder.standard()
.withRegion(region)
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.build();
Also, I am using this to build the ARN -
RefreshCacheRequest refreshCacheRequest = new RefreshCacheRequest();
refreshCacheRequest.setFileShareARN("arn:aws:storagegateway:"+region+":"+awsId+":"+shareID);
ARN is of the format,
arn:aws:storagegateway:region:account-id:share/share-id
Finally, I am refreshing the cache like this 0
awsStorageGateway.refreshCache(refreshCacheRequest);
I am getting this exception -
com.amazonaws.services.storagegateway.model.AWSStorageGatewayException: User: arn:aws:iam::12345:user/system/func-user is not authorized to perform: storagegateway:RefreshCache on resource: arn:aws:storagegateway:region:account-id:share-id (Service: AWSStorageGateway; Status Code: 400; Error Code: AccessDeniedException; Request ID:request ID)
Am I missing anything here?
I am pretty sure IAM access key which I have has the previlages.
PS - account-id which I have given is the Access Key of IAM