Direkt zum Inhalt

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)')?

gefragt vor einem Jahr385 Aufrufe
1 Antwort
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
SUPPORT-TECHNIKER
beantwortet vor einem Jahr
EXPERTE
überprüft vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.