Q:

where to specify S3 file locations when submitting pig program via AWS CLI

I'm creating a cluster and submitting a Pig step via AWS CLI.  Both the PIG script and the input file to the script are stored in an S3 bucket.
example Pig script:
REGISTER file:/usr/lib/pig/lib/piggybank.jar;
DEFINE XPath org.apache.pig.piggybank.evaluation.xml.XPath();
A = LOAD 's3://my-group/myfolder/somedata.xml' USING org.apache.pig.piggybank.storage.XMLLoader('item') AS (x:chararray);
B = FOREACH A GENERATE XPath(x, 'detail');
STORE B INTO 's3://my-group/myfolder/somedetails';

example CLI:
aws emr create-cluster \
--steps Type=PIG,Name='Pig program',ActionOnFailure=CONTINUE, \
Args=[-f,s3://my-group/myfolder/some_script.pig, \
-p,INPUT=s3://my-group/myfolder,-p,OUTPUT=s3://my-group/myfolder] \
--applications Name=Pig --enable-debugging \
--log-uri s3://my-group/myfolder --release-label emr-5.2.0 \
--instance-groups \
InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m3.2xlarge \
InstanceGroupType=CORE,InstanceCount=5,InstanceType=c1.medium \
--name "Test cluster" --ec2-attributes KeyName=ClusterKeyPair

which seems to be working (at least hasn't failed)...
but is it necessary for the s3://my-group/myfolder be specified in both locations?  If not what is the preferred way to write this?

A:

It turns out that within the Pig script, instead of hard-coding the locations I can use EMR Job Flow Parameters $INPUT and $OUTPUT, as in:
A = LOAD '$INPUT' USING org.apache.pig.piggybank.storage.XMLLoader('item') AS (x:chararray);
B = FOREACH A GENERATE XPath(x, 'detail');
STORE B INTO '$OUTPUT';

Source: Programming Elastic Mapreduce, ch. 4

