Trying to create aws transfer access via CLI

0

Hi, I am trying to create aws file transfer access using CLI. Trying to add two folder permissions but getting below error.

aws transfer create-access --home-directory-type LOGICAL --home-directory-mappings [{"Entry":"/","Target":"/bucket_name/${transfer:Username}/folder1" },{ "Entry": "/", "Target":"/bucket_name/${transfer:Username}/folder2"}] --role arn:aws:iam::account_id:role/iam-role --server-id s-123456789ert43 --external-id S-1-2-34-123456789-1234567-123456789-1234

Error:

Error parsing parameter '--home-directory-mappings': Invalid JSON:
[{Entry:/,Target:/bucket_name//folder1

Any idea, what wrong with CLI command? Thanks in advance.

profile picture
asked a month ago50 views
2 Answers
1
Accepted Answer

I was missing colon as suggested by @aws-user-Nitin and also When Entry is “/” you can only have one mapping, as overlapping paths are not allowed so added sub-directory to Entry.

aws transfer create-access --home-directory-type LOGICAL --home-directory-mappings '[{"Entry":"/folder1","Target":"/bucket_name/${transfer:Username}/folder1" },{ "Entry": "/folder2", "Target":"/bucket_name/${transfer:Username}/folder2"}]' --role arn:aws:iam::account_id:role/iam-role --server-id s-123456789ert43 --external-id S-1-2-34-123456789-1234567-123456789-1234
profile picture
answered a month ago
1

Hi - It expects property name enclosed in double quotes. Try to do like this by enclosing the json in single quote (')

--home-directory-mappings '[{"Entry":"/","Target":"/bucket_name/${Transfer:UserName}/folder1" },{ "Entry": "/", "Target":"/bucket_name/${Transfer:UserName}/folder2"}]'

Hope this helps.

profile picture
EXPERT
answered a month ago
  • Thank you for reply. It helps but got another error

    ''' An error occurred (InvalidRequestException) when calling the CreateAccess operation: [Root directory mapping does not allow other mappings: / -> /bucket_name/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/folder2] ''''

    Is another mapping not allowed?

  • I am able to figure it out and wad able to add multiple mapping. Entry "/" wont allow multiple mapping but specific folders to adding Entry: "folder1" and Entry:"folder2" helped.

    but now after login to SFTP, I dont see folder1 and folder2. Also, not able to put file.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions