Skip to content

Table Input Parameters

Since AWS operates as a REST service, some tables require parameters to be provided in order to return their contents. A common example is listing the contents of an S3 bucket, which requires knowing the S3 bucket name. Without the bucket name, S3 doesn’t know which bucket to list, it simply doesn’t start listing the contents of all buckets.

Input parameters for tables are automatically determined from the WHERE clause of a SQL query.

The parameters may cause more than one API call to be issued to AWS. A common example of this would be a table that only takes a single parameter, such as S3 bucket name, lets call it the bucket column. If a SQL query where to match multiple values in the bucket column, the AWS for Query.Farm integration will make multiple AWS API calls.

Details

Example: Listing the Contents of S3 Bucket

The following query shows how to list the contents of a bucket named example-bucket-name, using a specific AWS profile (test-account-1). Note that not all profiles may have access to this bucket.

SELECT unnest(contents, max_depth := 2) * excluding(contents),
FROM aws.s3.list_objects_v2
WHERE bucket = 'example-bucket-name' AND
_aws_profile.name = 'test-account-1';

If you wanted to list the contents of multiple S3 buckets you can formulate the SQL like this:

SELECT unnest(contents, max_depth := 2) * excluding(contents),
FROM aws.s3.list_objects_v2
WHERE bucket in ('bucket-1', 'bucket-2');

Common Questions

How to Identify Input Parameters for a Table

To find the required input parameters for a table, refer to the table’s schema or the online documentation available on this website. The input parameters are listed in the schema section.

Valid Forms for Input Parameters

Input parameters should be specified using conditions such as = or IN. This allows the service to extract the appropriate values for each parameter and determine the correct AWS API to call with those parameters.

Using Different Parameters for AWS Regions or Profiles

Yes, you can specify different parameters for various AWS regions or profiles. Here’s how you can list the contents of different buckets for different AWS profiles:

SELECT unnest(contents, max_depth := 2) * EXCLUDING(contents)
FROM aws.s3.list_objects_v2
WHERE
(bucket = 'prod-bucket-name' AND _aws_profile.name = 'production-account-1')
OR
(bucket = 'dev-bucket-name' AND _aws_profile.name = 'dev-account-1')