AWS Transcribe服务输出的文件显示访问被拒绝,即使权限已设置。

huangapple go评论87阅读模式
英文:

AWS Transcribe service outputs a file with access denied, even with permissions set

问题

我正在测试AWS转录服务用于一个项目,在运行开始转录作业之后,文件以指定的名称“.json”正确输出,但内容显示错误。

我对AWS还不熟悉,不确定问题出在哪里。我尝试了不同的IAM权限,但输出仍然相同。

英文:

I am testing the AWS transcribe service for a project, after runing the start transcritpion job

var TrsSession *transcribeservice.TranscribeService

func TranscribeTest() (trsOutput *transcribeservice.StartTranscriptionJobOutput, err error) {
	trsOutput, err = TrsSession.StartTranscriptionJob(&transcribeservice.StartTranscriptionJobInput{
		TranscriptionJobName: aws.String("gettysburg_test"),
		IdentifyLanguage:     aws.Bool(true),
		MediaFormat:          aws.String("wav"),
		OutputBucketName:     aws.String(os.Getenv("AWS_BUCKET_NAME")),
		Media: &transcribeservice.Media{
			MediaFileUri: aws.String("s3://" + os.Getenv("AWS_BUCKET_NAME") + "/gettysburg.wav"),
		},
	})

	if err != nil {
		fmt.Println(err)
		return trsOutput, err
	}

	return trsOutput, nil
}

the file outputs properly wwith the specified name .json but the content shows an error

<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>JDP5*****5QQJ</RequestId>
  <HostId>wnd5k6x********************TDwqIpe53S1w=</HostId>
</Error>

I am new to aws I am not sure where the problem is

I am new to aws I am not sure where the problem is.
I tried different IAM permission but still the same output.

答案1

得分: 0

您很可能需要为您的S3存储桶设置存储桶策略,以允许AWS Transcribe访问输入和输出存储桶,例如:

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Principal": {
          "Service": [
            "transcribe.amazonaws.com"
          ]
        },
        "Action": [
            "s3:GetObject",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::DOC-EXAMPLE-INPUT-BUCKET",
            "arn:aws:s3:::DOC-EXAMPLE-INPUT-BUCKET/*"
        ]
    }
}

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Principal": {
          "Service": [
            "transcribe.amazonaws.com"
          ]
        },
        "Action": [
            "s3:PutObject"
        ],
        "Resource": [
            "arn:aws:s3:::DOC-EXAMPLE-OUTPUT-BUCKET/*"
        ]
    }
}

此处所述。

英文:

You most likely need bucket policies for your S3 buckets to allow AWS Transcribe to access both the input and output buckets, for example:

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Principal": {
          "Service": [
            "transcribe.amazonaws.com"
          ]
        },
        "Action": [
            "s3:GetObject",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::DOC-EXAMPLE-INPUT-BUCKET",
            "arn:aws:s3:::DOC-EXAMPLE-INPUT-BUCKET/*"
        ]
    }
}

and

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Principal": {
          "Service": [
            "transcribe.amazonaws.com"
          ]
        },
        "Action": [
            "s3:PutObject"
        ],
        "Resource": [
            "arn:aws:s3:::DOC-EXAMPLE-OUTPUT-BUCKET/*"
        ]
    }
}

as described here

huangapple
  • 本文由 发表于 2022年11月12日 04:27:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/74407776.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定