oracle / oci-java-sdk

Oracle Cloud Infrastructure SDK for Java
https://cloud.oracle.com/cloud-infrastructure
Other
203 stars 153 forks source link

Cannot able to create cross region Dataguard with instance principals #390

Closed krishnachaitanya5 closed 1 year ago

krishnachaitanya5 commented 2 years ago

I am using Instance principals , db client to create a cross region , though I am setting the region in the dbclient it is not creating the DG on the cross region , but it is creating in the same region ? Does instance principals work differently for cross regions

jodoglevy commented 2 years ago

@krishnachaitanya5 can you share a code sample which reproduces this issue? Also, if you switch to using user principals auth (API key auth), does it work correctly? This will help determine if the cause of the issue has to do with instance principals, or not

krishnachaitanya5 commented 2 years ago

Hi @jodoglevy , We have tested the cross region is working from oci-cli with instance principals , its working fine While doing from SDK we are getting this issue "com.oracle.bmc.model.BmcException: (404, NotAuthorizedOrNotFound, false) The following tag namespaces / keys are not authorized or not found: 'oracle-tags' (opc-request-id: 983C85E491944C2F86FE35764B9A1B28/04E3F0F068ACFD90DA7B472572D10832/819306986D0B7CD2DDA3E03E79BE3664)"

Can you help us here ?

Sample code attached below: Instance principals: BasicAuthenticationDetailsProvider provider = InstancePrincipalsAuthenticationDetailsProvider.builder().build(); DatabaseClient dbClient = new DatabaseClient(provider); dbClient.setRegion(Region.US_PHOENIX_1); CreateCrossRegionAutonomousDatabaseDataGuardDetails crossRegionAtpDetails = createAtpDataguardRequest(compartmentId,primaryAtpId,atpName);

AutonomousDatabase crossRegionAtp = createATP(dbClient, crossRegionAtpDetails);

Details:
CreateCrossRegionAutonomousDatabaseDataGuardDetails.builder() .cpuCoreCount(m_properties.getPropertyAsInteger(1) .dataStorageSizeInTBs(1) .displayName(atpName) .dbName(atpName) .compartmentId(compartmentId) .dbWorkload(CreateAutonomousDatabaseDetails.DbWorkload.Oltp) .licenseModel(CreateAutonomousDatabaseDetails.LicenseModel.LicenseIncluded) .sourceId(seedId)
.build();

Response : CreateAutonomousDatabaseResponse response = dbClient .createAutonomousDatabase(CreateAutonomousDatabaseRequest.builder().createAutonomousDatabaseDetails(createRequest).build());

jodoglevy commented 2 years ago

@krishnachaitanya5 as requested earlier - if you switch to using user principals auth (API key auth), does it work correctly?

The error you are getting seems to indicate some tags being set on the resource either don't exist, or your instance which is making this call is not authorized to add/change those tags. If you open a support request with the OCI Database service, they should be able to look into your opc-request-id and provide more info about why you are getting this error.

krishnachaitanya5 commented 2 years ago

Thanks @jodoglevy I will raise a ticket to them

aballuri commented 2 years ago

@krishnachaitanya5 While creating a cross region standby you must pass the same tags as of the source database.

Prachitbooks commented 2 years ago

Please provide working on how to use CreateCrossRegionAutonomousDatabaseDataGuardDetails.

KartikShrikantHegde commented 1 year ago

Hi @krishnachaitanya5 , Looks like this issue is resolved via the support ticket. Is that a correct assumption? If so I will go ahead and close this ticket.

KartikShrikantHegde commented 1 year ago

Closing this ticket as we haven't heard in a while. Please feel free to open the ticket if you need more info.