How to copy data from a file in S3 bucket to Redshift tables

Copy using iam role:

copy schemaname.tablename      
from 's3://bucketname/filename'
iam_role 'arn of iam role'     
DELIMITER '|'                  
ESCAPE;                        

Copy using credentials:

copy schemaname.tablename                                         
from 's3://bucketname/filename'                                   
credentials 'aws_access_key_id=XXXXXX;aws_secret_access_key=XXXXX'
DELIMITER '|'                                                     
ESCAPE;                                                           
See also  How to install and configure AWS CLI on Windows and Linux machines