So far, we have used a public bucket. What if you have a private bucket? How do you tell Teradata what credentials it should use?
It is possible to inline your credentials directly into your query:
SELECT
TOP 10 *
FROM (
LOCATION='/s3/td-usgs-public.s3.amazonaws.com/CSVDATA/'
AUTHORIZATION='{"ACCESS_ID":"","ACCESS_KEY":""}'
) AS d;
Entering these credentials all the time can be tedious and less secure. In Teradata, you can create an authorization object that will serve as a container for your credentials:
CREATE AUTHORIZATION aws_authorization
USER 'YOUR-ACCESS-KEY-ID'
PASSWORD 'YOUR-SECRET-ACCESS-KEY';
You can then reference your authorization object when you create a foreign table. First, drop the riverflow table created in the previous section, then recreate it with the authorization attached:
DROP FOREIGN TABLE riverflow;
CREATE FOREIGN TABLE riverflow
, EXTERNAL SECURITY aws_authorization
USING ( LOCATION('/s3/td-usgs-public.s3.amazonaws.com/CSVDATA/') );