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
질문됨 2년 전777회 조회
2개 답변
1
수락된 답변

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
답변함 2년 전
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 pictureAWS
전문가
답변함 2년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠