내용으로 건너뛰기

How to specify destination of CreateExportJobRequest in AWS SES?

0

I am trying to follow https://docs.aws.amazon.com/ses/latest/dg/vdm-dashboard.html#vdm-dashboard-export-message-cli . Specifically it says: "These examples show you how to use the CreateExportJob operation to search and find particular messages you've sent, see their current delivery and engagement status, and export the results of your search to a .csv or .json file using the AWS CLI. This is the same data used in the Virtual Deliverability Manager dashboard's Messages table.".

I have the following code (in Java):

        String s3Url = "s3://my-bucket-name/export-files/";
        Instant now = Instant.now();
        CreateExportJobRequest request = CreateExportJobRequest.builder()
                .exportDataSource(
                        ExportDataSource.builder()
                                .messageInsightsDataSource(
                                        MessageInsightsDataSource.builder()
                                                .startDate(now.minus(7, ChronoUnit.DAYS))
                                                .endDate(now)
                                                .include(
                                                        MessageInsightsFilters.builder()
                                                                .destination("myname@mydestination.com")
                                                                .build()
                                                )
                                                .build()
                                )
                                .build()
                )
                .exportDestination(
                        ExportDestination.builder()
                                .dataFormat(DataFormat.JSON)
                                .s3Url(s3Url)
                                .build()
                )
                .build();

CreateExportJobResponse response = client.createExportJob(request);

But I am getting an error "software.amazon.awssdk.services.sesv2.model.BadRequestException: Providing a custom S3 URL is not supported (Service: SesV2, Status Code: 400, Request ID: XX-YY-ZZ)"

But how else can I specify the destination S3 bucket? Is there some other way I am supposed to generate the url? Or is that specified elsewhere? If not, how do I download the file generated by createExportJob (the run works if I comment out the line '.s3Url(s3Url)')?

1개 답변
1

Error "Providing a custom S3 URL is not supported" is expected when you specify a custom S3 URL while invoking CreateExportJob operation. CreateExportJob does not support providing the S3Url. Hence you would need to run the code without specifying the S3Url.

After CreateExportJob is run job id will output and a temporary S3 presigned URL is provided in the output of the get-export-job CLI command, so that you can access the data. The presigned URLs is from an internal S3 bucket and the URL expires after 5 minutes (but you can get a new URL one with each GetExportJob call).

Useful Links: [1] https://docs.aws.amazon.com/cli/latest/reference/sesv2/create-export-job.html [2] https://docs.aws.amazon.com/ses/latest/APIReference-V2/API_GetExportJob.html

AWS
지원 엔지니어
답변함 일 년 전
전문가
검토됨 일 년 전

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

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

관련 콘텐츠