cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Instance Profile creation via the Databricks REST API returns "INVALID_PARAMETER_VALUE"

lasmali
New Contributor II

# Problem Statement

We have a need to create Instance Profiles via the Databricks REST API, but the endpoint returns an "INVALID_PARAMETER_VALUE" error with "Syntactically invalid AWS instance profile ARN" message even when provided an appropriate ARN as input.

# What's been done

  1. Creating Role and Instance Profile on Databricks AWS account via AWS CLI
  2. Calling /instance-profiles/add to register Instance Profile in Databricks

# Code

def create_instance_profile(instance_profile_arn, skip_validation = False):
    api_command = '/instance-profiles/add'
    api_version = f'/api/2.0'
    url = f"https://{DATABRICKS_HOST}{api_version}{api_command}"
 
    params = {
      "instance_profile_arn" : instance_profile_arn,
      "skip_validation" : skip_validation,
      "is_meta_instance_profile" : False
    }
 
    header = {
        "accept": "application/scim+json",
        "Authorization": f"Bearer {DATABRICKS_TOKEN}"
    }
 
    response = requests.post(url, params = params, headers=header)
 
    print(json.dumps(json.loads(response.text), indent = 2))
 
arn = "arn:aws:iam::<account_id>:instance-profile/my-instance-profile-name"
create_instance_profile(arn)

3 REPLIES 3

Debayan
Databricks Employee
Databricks Employee

Hi, Is this a constant error or intermittent? For newly added profiles AWS has a buffer time and sometimes it is intermittent. Also, could you please provide the full error here along with the screenshot? (Also, you can refer: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_iam-ec2.html)

lasmali
New Contributor II

Hi @Debayan Mukherjee​ , I havn't been able to make a successful request via the API (although I'm able to list the instance profiles on our Databricks account via the API), but I can add the instance profile via the Databricks UI without problem.

Here's the response from the Databricks API.

error-message

Anonymous
Not applicable

Hi @lasse Lidegaard​ 

Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group