FileMaker, AWS CLI, BaseElements and Mac OS

Simple way to interact with AWS CLI using FileMaker, BaseElements on Mac OS.

By passing the AWS key and secret in the command the problems with environment variables is solved – which makes troubleshooting from the command and BaseElements identical environments.

 

# AWS CLI for Mac

# $ brew install aws

# $ aws configure – brew install aws

# /Users/[user/.aws/credentials

# example is for download files from S3

# test with sample command on command line

# $ aws s3 cp s3://[bucket]/[filename] .

Set Variable [ $aws ; Value: “/usr/local/bin/aws s3 cp” ] 

Set Variable [ $access ; Value: “aws_access_key_id=XXX” ] 

Set Variable [ $secret ; Value: “aws_secret_access_key=XXX” ] 

Set Variable [ $s3bucket ; Value: “[bucket]” ] 

Set Variable [ $path ; Value: “[filename]” ] 

# 

Set Variable [ $source ; Value: “s3://” & $s3bucket & “/” & $path ] 

Set Variable [ $target ; Value: “/Users/[username]/Desktop/.” ] 

Set Variable [ $$command ; Value: $access & “; ” & $secret & “; ” & $aws & ” ” & $source & ” ” & $target ] 

# 

Set Variable [ $$download ; Value: BE_ExecuteSystemCommand ( $$command ) ] 

If [ not PatternCount ( $$download ; “Completed” ) ] 

Exit Script [ Text Result:    ] 

End If

# 

Show Custom Dialog [ “ALERT” ; $$download ] 

If [ Get(LastMessageChoice) = 2 ] 

Exit Script [ Text Result:    ] 

End If

# 

Set Variable [ $desktop ; Value: Get ( DesktopPath ) ] 

Set Variable [ $file ; Value: $desktop & $path ] 

Import Records [ With dialog: Off ; Table: [table] ; “$file” ; Add; UTF-8 ] 

Delete File [ Target file: “$file” ]