Hello,
I have set my tks3.config file to get some acces to the dev environment. But How do we do that If I have to extra environment to configure. ex:
dev
intg
uat
which have different keyID and secret. How do we set the tks3.config file in that case. Please provice an example
You really need to provide more details of what you are doing and not just mention some obscure config file. I'm going to guess that you are accessing an Amazon S3 cloud platform. If so and you are using PROC S3 then you can specify the TKS3 CONFIG like so:
Going by the example you could just create dev, intg and uat folders (/u/marti/dev/.tks3.conf) each with their own config file then refer to them as above.
Hello,
I have created more than two years ago my &home/.tks3.conf many months ago which contains keyID, secret and the region as well.
Unfortunately, I don't remember how I have created it and on top of that, the value found into that file are not the one I see on Amazon when I go on AWS access portal. To use three different folders for dev, intg and uat is a very good idea. The first steps I want to do is to get the list of the files into each bucket. You will find my SAS code below. Only the old dev values into the home/.tks3.config file is working. It is strange.
How can I solve that issue?
can you provide me your SAS script just to get the files listing using either a pipe command or a proc s3 and passing the .tks3 value in it.
%macro FindingMasterListPolicyName(env);
%let filelist=/&path1./s3filestodownload.txt;
/***** Selecting the good s3 bucket path according to the environment selected *****/
%if &env eq dev %then %let s3bucketpath=s3://dev-pr-brz-datareten-edp-nprod;
%else %if &env eq intg %then %let s3bucketpath=s3://intg-pr-brz-datareten-edp-nprod;
%else %if &env eq uat %then %let s3bucketpath=s3://uat-pr-brz-datareten-edp-nprod;
%put &=env &=s3bucketpath;
/*********************************************************************************/
filename oscmd pipe "aws s3 ls ""&s3bucketpath."" --recursive | grep .csv ";
data foldercontents2 ;
length text $2000. fnameandpath $200.;
infile oscmd;
input;
text=_infile_;
run;
data foldercontents2 (drop=text);
set foldercontents2 ;
creationdate=scan(text,1,' ');
creationtime=scan(text,2,' ');
filesize=scan(text,3,' ');
fnameandpath =scan(text,1," ","b");
FName =scan(text,1,"/","b");
path=substr(fnameandpath,1,length(fnameandpath)-length(FName)- 1);
where find(text,'MASTER_LIST') > 0 AND find(text,'_Policy_') > 0 AND find(text,'ARCHIVE') = 0;
run;
proc sort data=foldercontents2 out=foldercontents;
by creationdate creationtime FName;
run;
/*** Getting the path and file name of the Master List to download ***/
Data _null_;
set foldercontents;
if _n_ = 1 then
do;
call symputx('MasterListName',Fname,'g');
call symputx('masterlistfilepath',Path,'g');
end;
run;
%put &=masterlistfilepath. &=MasterListName.;
%goto exit;
filename filelist "&filelist";
data _null_;
FILE filelist LRECL=150 recfm=v;
put "&masterlistfilepath./&MasterListName.";
;
run;
%exit: %mend FindingMasterListPolicyName;
%FindingMasterListPolicyName(dev);
I've never used PROC S3 / AWS. The advice I posted was from SAS documentation. If the link I provided doesn't help then I'd suggest opening a track with SAS Tech Support.
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.