Slice Notes

This content is in snippets/aws/slicenotes.md

get list of files from s3 - $SLICE

for $SLICEUD in list.txt
do
cat <<EOF >> '$SLICEUD'.txt
aws s3 cp s3://js-kt-slice/$SLICEUD .
echo "$(echo '#!/bin/bash' | cat - $SLICEUD)" > $SLICEUD
chmod +x $SLICEUD
./$SLICEUD 2>&1 | tee $SLICEUD-output.txt
aws s3 cp $SLICE-output.txt s3://js-kt-slice/
<<EOF>>



generate userdata

for i in list.txt 

#!/bin/bash
for SLICE in list.txt;
do
aws ec2 run-instances --image-id ami-a4c7edb2 --count 1 \
     --instance-type t3.large --key-name prod-2018522 \
     --subnet-id subnet-b9a0aaf0 --user-data file://$SLICE-userdata.txt
     --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=$SLICE}]'
done;



#!/bin/bash -x
for SLICEUD in $(cat list.txt);
do
    {
        echo "#!/bin/bash"
        echo "aws s3 cp s3://kt-getwell-30/kt-python.py ."
        echo "chmod +x kt-python.py"
        echo "aws s3 cp s3://kt-getwell-30/$SLICEUD ."
        echo "python ./kt-python.py $SLICEUD 2>&1 | tee $SLICEUD-output.txt"
        echo "aws s3 cp '$SLICEUD'-output.txt s3://ky-getwell-30/output/"
    } >> $SLICEUD-userdata.txt

done;


yum update
yum install python3 -y
pip3 install pymysql
pip3 install requests
aws s3 cp s3://kt-getwell-30/call_recording_rectifier.py .
aws s3 cp s3://kt-getwell-30/call_recording_rectify.py .





aws s3 cp s3://kt-getwell-30/kt-python.py .
chmod +x kt-python.py
aws s3 cp s3://kt-getwell-30/$SLICEUD .
python ./kt-python.py $SLICEUD 2>&1 | tee $SLICEUD-output.txt
aws s3 cp '$SLICEUD'-output.txt s3://ky-getwell-30/output/



#!/bin/bash -x
for SLICEUD in $(cat list.txt);
do
    {
        echo "#!/bin/bash"
	echo "yum update -y"
	echo "yum install python3 -y"
	echo "pip3 install pymysql"
	echo "pip3 install requests"
        echo "aws s3 cp s3://kt-getwell-30/call_recording_rectifier.py ."
        echo "aws s3 cp s3://kt-getwell-30/call_recording_rectify.py ."
        echo "chmod +x call_recording_rectifier.py"
        echo "aws s3 cp s3://kt-getwell-30/$SLICEUD ."
        echo "python3 ./call_recording_rectifier.py --account_id 10000040 --check_only false --account_sid xxxxxxxxxxxxxxx --file_path ./input.csv --destination_bucket keep-truckin-ring-dna --environment prod --twilio_http_auth xxxxxxxxxxxxx:xxxxxxxxxxxxx call_recording_rectifier.py 2>&1 | tee $SLICEUD-output.txt"
        echo "aws s3 cp '$SLICEUD'-output.txt s3://kt-getwell-30/output/"
    } >> $SLICEUD-userdata.txt

done;




python3 ./call_recording_rectifier.py --account_id 10000040 --check_only false --account_sid XXXXXXXXXXXXXXX --file_path ./input.csv --destination_bucket companyname --environment prod --twilio_http_auth xxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxx