mohankumarpaluru / oracle-freetier-instance-creation

A script to create free instance
MIT License
176 stars 34 forks source link

404 NotAuthorizedOrNotFound Error. #5

Closed Muramono closed 8 months ago

Muramono commented 8 months ago

Hello, I've tried following all the README instructions, but I am getting the follow error after running the script. Also for context I cannot currently get a oracle micro instance so I am running the script locally and modified the subnet with my own subnet and commented out line 299-301 as you suggested per another issue. I've tried to include all the possibly helpful info below, but let me know if you need anything else.

Launch_instance.log error

Things I've tried so far

oci.env for Reference

OCI Configuration

  OCI_CONFIG=/home/mura/oracle-freetier-instance-creation/oci_config
  OCT_FREE_AD=AD-1,AD-2,AD-3
  DISPLAY_NAME=Server-Hoster
  REQUEST_WAIT_TIME_SECS=60
  SSH_AUTHORIZED_KEYS_FILE=/home/mura/oracle-freetier-instance-creation/id_rsa.pub
  OCI_IMAGE_ID=
  # The following will be ignored if OCI_IMAGE_ID is specified
  OPERATING_SYSTEM=Canonical Ubuntu
  OS_VERSION=22.04

  # Gmail Notification
  NOTIFY_EMAIL=True
  EMAIL=<censored>
  EMAIL_PASSWORD=<censored>

OCI_Config for reference [DEFAULT] user=ocid1.user.oc1..aaaaaaaay......... fingerprint=51:eb:....... tenancy=ocid1.tenancy.oc1..aaaaaaaab....... region=us-chicago-1 key_file=/home/mura/oracle-freetier-instance-creation/oci_api_private_key.pem

Error Trace I get from running the main.py

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/mura/oracle-freetier-instance-creation/main.py", line 373, in launch_instance() File "/home/mura/oracle-freetier-instance-creation/main.py", line 369, in launch_instance handle_errors("launch_instance", data, logging_step5) File "/home/mura/oracle-freetier-instance-creation/main.py", line 216, in handle_errors raise Exception("Error: %s" % data) Exception: Error: {'status': 404, 'code': 'NotAuthorizedOrNotFound', 'message': 'Authorization failed or requested resource not found.'}

mohankumarpaluru commented 8 months ago

The issue might be an incorrect subnet ID. Please confirm that the oci_subnet_id variable on line 302 matches the following pattern:

Double-check that there are no typos or extra characters in the subnet ID provided.

Muramono commented 8 months ago

@mohankumarpaluru Sorry I'm not super familiar with network stuff, but since I am using my local machine instead of a oracle mini VM I used ifconfig to find my netmask and set that as the subnet ID. My subnet that I get from that is formatted xxx.xxx.xxx.x . I'm also not sure if this would cause any issues, but I am trying to run this on a WSL ubuntu instance. Any other ideas?

mohankumarpaluru commented 8 months ago

@maciekniewielki

okay that's your local subnet but we can't create the Instance in that subnet so you got to create a VPC in the Oracle Cloud Console, establish a subnet within it, and utilize the specific subnet's OCI ID in line 302 for seamless integration.

it's fairly simple process, try searching on how to create VPC/Subnet in Oracle cloud you should see some examples. let me know if you face any issues

Muramono commented 8 months ago

@mohankumarpaluru Thank you I got it working now with this. I actually already had a subnet setup, but I didn't fully understand which subnet was required for that step. Thank you for a very well documented and helpful github.