title: How to create a parent resource in AWS API Gateway?
body: <p>When using the AWS Api-Gateway service, I'd like to add a "parent" resource without deleting and rebuilding the resource structure. Specifically, I'd like to change this:</p>
  
  <pre><code>resource/name
  resource/name
  </code></pre>
  
  <p>And add a "parent" resource to it (v1) without deleting and remaking the two "resource/name" resources, like this:</p>
  
  <pre><code>/v1
    /resource/name
    /resource/name
  </code></pre>
  
  <p>If it requires use of the CLI, what would an example command look like?</p>
  
  <p>UPDATE:</p>
  
  <p>Thanks for the great answer Ka Hou Ieong. Here are some notes on implementing it:</p>
  
  <pre><code>rest-api-id : Put the api id here. You can look it up with this command: aws apigateway get-rest-apis
  
  resource-id : Put the id of the resource you'd like to move here. You can look it up with this command: aws apigateway get-resources --rest-api-id API-ID-HERE
  
  replace : Leave this; it's the operation.
  
  /parentId : Leave this. It refers to the "key" of the value that you'll replace.
  
  &lt;new parent resourceId&gt; : Replace this with the ID of the parent you'd like.
  </code></pre>