Reputation: 608
I have to use aws temporary credentials AccessKey, SecretKey and Token within nifi process to access S3 objects. AccessKey, SecretKey and Token will be provided by an Api call. How to use these temperory credentials in nifi ListS3 Object etc?
One of the options I found is using AWSCredentialsProviderControllerService since this Can I update the values of a controller service based on an API call?
Any other options that I can use in this scenario?
Thanks! Ani
Upvotes: 3
Views: 2705
Reputation: 4132
Yeah, we can leverage AWSCredentialsProvider
controller service and NiFi REST API to build this although it may be a bit complex. Nevertheless, let's sketch it out here.
Whatever action you do on NiFi - updating the processor/controller service configuration, stopping/starting services/processors, are all making API calls in the backend. NiFi framework makes the call behind the scenes. And since we also have HTTP processors like InvokeHTTP
we could build this thing. I could think of a something like the below:
cp-id
. We'll use it later.ListS3 -> <OTHER_PROCESSORS>
. Configure the ListS3 processor with the AWSCredentialsProvider we created in Step #1.ListS3
processor. Let's call it s3-id
InvokeHTTP
and configure it to your service endpoint which gives you your temporary AWS credentials. Use the credentials in and make another call with InvokeHTTP to NiFi server with PUT /controller-services/{cp-id}
endpoint to update the propertiesPUT /controller-services/{cp-id}/run-status
. This will enable the controller service which means now you can start the ListS3 processor which can again be done again using a HTTP call to NiFi server: PUT /processors/{s3-id}/run-status
Some useful links:
Upvotes: 4