Sample Header Ad - 728x90

Include Variable in S3 CP command for include block

0 votes
1 answer
890 views
I have a scenario where I want to include some files names in S3 cp command but it keeps failing. Below is my command:-
DATE=$(date '+%Y%m%d')
/usr/local/bin/aws s3 cp "/test/copy" "s3://test-bucket/test/copy/" --include "TEST_$DATE.REQHE" --include "TEST_$DATE.ERRMSG_REQHE"
I am getting below error while running the command :-
upload failed: ./ to s3://test-bucket/test/copy/ [Errno 21] Is a directory: '/test/copy'
Can someone help me to modify the command so that it can work. Output of manual commands :-
[root@server:/home/linux]$ /usr/local/bin/aws s3 cp /test/copy/ s3://test-bucket/test/copy/ --include "TEST_20211220.REQHE" --profile aws-s3 --sse aws:kms --sse-kms-key-id ab457654f-6562-43df-124l-4et75653bq12
upload failed: ../../test/copy to s3://test-bucket/test/copy/ [Errno 21] Is a directory: '/test/copy/'
[root@server:/home/linux]$ /usr/local/bin/aws s3 cp "/test/copy/" "s3://test-bucket/test/copy/" --include "TEST_20211220.REQHE" --profile aws-s3 --sse aws:kms --sse-kms-key-id ab457654f-6562-43df-124l-4et75653bq12
upload failed: ./../test/copy to s3://test-bucket/test/copy/ [Errno 21] Is a directory: '/test/copy/'
[root@server:/home/linux]$ /usr/local/bin/aws s3 cp "/test/copy" "s3://test-bucket/test/copy/" --include "TEST_20211220.REQHE" --profile aws-s3 --sse aws:kms --sse-kms-key-id ab457654f-6562-43df-124l-4et75653bq12
upload failed: ./../test/copy to s3://test-bucket/test/copy/ [Errno 21] Is a directory: '/test/copy/'
Thanks in Advance
Asked by Ashmit (1 rep)
Dec 20, 2021, 09:38 AM
Last activity: Dec 21, 2021, 07:54 AM