[Atlas] Authentication failed for running compact command on oplog.rs with atlasAdmin role

Hi.
I use MongoDB Atlas M20 instance.
I had an issue with huge oplog size(50GB) with storage auto scale option enabled.
So I turned off auto scaling and set Maximum Oplog Size as 990MB to prevent oplog size going to large.
Next, I wanted to run compact command on oplog collection to make disk size smaller but failed to run with authentication failed message.

{
	"message" : "not authorized on local to execute command { compact: 'oplog.rs', $clusterTime...

I found related articles but nobody seems to have an authentication issue like me.

Can anyone give me an advice?

This is a more detailed status of my instance.

VERSION

5.0.15

REGION

AWS / Tokyo (ap-northeast-1)

CLUSTER TIER

M20 (General)

TYPE

Replica Set - 3 nodes

Atlas admin role may not be having privilege to run compact command
May be you have to create a custom role giving explicit privileges/actions

1 Like

You can try dbAdmin@local to see if that works for you.