SQL SERVER Backup to S3 bucket fail: "Msg 3078, Level 16, State 1, Line 21 The file name "s3://mybucket/foder" is invalid as a backup device name for the specified device type."

Mariano Facundo Podesta 20 Reputation points
2024-02-26T15:58:25.43+00:00

We have created a role in AWS to store the backups in a bucket, we have checked its correct operation using the "aws s3 cp" command and it works fine. But when we launch the backup we get this error:

CREATE CREDENTIAL [s3://MyBucket/] WITH            IDENTITY = 'S3 Access Key'       ,SECRET   =  'AKIAT----------:KrA4ky0ADqNFtaWDOKh/Wq-------'; BACKUP DATABASE [My_database]         TO URL =   's3://MyBucket/database.bak'        WITH COMPRESSION, STATS = 10, FORMAT, INIT;   

Msg 3078, Level 16, State 1, Line 10 The file name "s3://MyBucket/database.bak" is invalid as a backup device name for the specified device type. Reissue the BACKUP statement with a valid file name and device type.

Msg 3013, Level 16, State 1, Line 10 BACKUP DATABASE is terminating abnormally.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,685 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 110.4K Reputation points MVP
    2024-02-26T22:32:06.8733333+00:00
    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. LiHongMSFT-4306 26,791 Reputation points
    2024-02-27T02:23:23.4966667+00:00

    Hi @Mariano Facundo Podesta

    The file name "s3://MyBucket/database.bak" is invalid as a backup device name for the specified device type. Reissue the BACKUP statement with a valid file name and device type.

    The S3 storage virtual host <virtualHost> or server domain <domainName> exists and is running using HTTPS. The endpoint will be validated by a CA installed on the SQL Server OS Host.

    <bucketName> is the name of this bucket where the backup is written. This must be created before running the backup T-SQL.

    Refer to this doc: SQL Server back up to URL for S3-compatible object storage best practices and troubleshooting.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Mariano Facundo Podesta 20 Reputation points
    2024-02-27T13:56:30.3633333+00:00

    Hello everyone, thanks for the help. I think we have found the problem and it is the version of my database, currently my version is:

    Microsoft SQL Server 2019 (RTM-CU22) (KB5027702) - 15.0.4322.2 (X64) Jul 27 2023 18:11:00 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)

    Reviewing the links that they sent me I could see that the compatibility with S3 URL is from version 16.X, therefore I must migrate the version as a first task. Thanks for your help.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.