Hangfire.MySqlStorage icon indicating copy to clipboard operation
Hangfire.MySqlStorage copied to clipboard

No access to Hangfire database in AWS

Open gregzhadko opened this issue 3 years ago • 0 comments

I have an asp.net core application with the MySql database. For deployment, I use AWS Lambda. The database is stored in AWS RDS, and it is already configured and used.

Now, I'm trying to add Hangfire to my project. It requires database, and I added Hangfire.MySqlStorage for it. The configuration code looks like that:

connectionString = "server={myHostPrefix}.rds.amazonaws.com;user={myUserName};pwd={myPassword};database=hangfire;Allow User Variables=True"
services.AddHangfire(c => c.UseStorage(
        new MySqlStorage(connectionString, new MySqlStorageOptions { TransactionIsolationLevel = IsolationLevel.ReadCommitted, TablesPrefix = "Hangfire" }))
    .UseSimpleAssemblyNameTypeSerializer()
    .UseRecommendedSerializerSettings());
services.AddHangfireServer(options => options.SchedulePollingInterval = TimeSpan.FromSeconds(10));

Everything works perfectly locally: Hangfire created all the required tables and filled them out with the data. However, when I try to deploy my app to the AWS, I get the following exception:

Access denied for user 'admin'@'10.1.0.218' (using password: YES): MySqlException

But the admin has access to the database. I use the same credentials in my Entity Framework code, and I can read and write to the DB. What could I miss?

gregzhadko avatar Mar 07 '21 16:03 gregzhadko