Example of fetch files from AWS S3 from within AdWords Scripts.
This solution provides example code for fetching files from S3 using the ES5 environment within AdWords Scripts.
-
Copy the code from
s3-example.jsand paste it into your AdWords Script. -
Initialize an
S3object:var s3 = new S3('<region>', '<access_key_id>', '<access_secret>');
-
Once initialized, to make an authorized
GETrequest:var response = s3.fetch('<AWS URL>');
The response object is of class HttpResponse.
To determine success therefore, call response.getResponseCode() to check for a status of 200, before obtaining the content with one of the other methods listed.