To create an Amazon Web Services cloud account with or without cloud zones, you make a POST request. The request body includes the parameters specific to Amazon Web Services that are required to create the cloud account.

Prerequisites

  • Verify that all general prerequisites and prerequisites for the Automation Assembler Infrastructure as a Service (IaaS) service have been satisfied. See Prerequisites for API Use Case Examples.
  • Verify that you have the Amazon Web Services access key ID and the Amazon Web Services secret access key for the new cloud account.

Procedure

  1. Assign the Amazon Web Services account variables.
    aws_access_key_id='<your_aws_access_key_id>'
    aws_secret_access_key='<your_aws_secret_access_key>'
    
  2. Submit a request to create an Amazon Web Services cloud account without default cloud zones.
    When the parameter createDefaultZones is left unspecified, the cloud account is created without default cloud zones by default.
    curl -X POST \
      "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "privateKeyId": "'$aws_access_key_id'",
        "cloudAccountType": "aws",
        "name": "<your_aws_cloud_account>",
        "description": "This is a demo AWS cloud account without cloud zones",
        "regionIds": [ "<your_region_id1>", "<your_region_id2>" ],
        "privateKey": "'$aws_secret_access_key'"
      }' | jq "."
  3. (Optional) Submit a request to create an Amazon Web Services cloud account with default cloud zones.
    curl -X POST \
      "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer $access_token" \
      -d '{
        "privateKeyId": "'$aws_access_key_id'",
        "cloudAccountType": "aws",
        "name": "<your_aws_cloud_account>",
        "description": "This is a demo AWS cloud account with default cloud zones",
        "regionIds": [ "<your_region_id1>", "<your_region_id2>" ],
        "createDefaultZones": true,
        "privateKey": "'$aws_secret_access_key'"
      }' | jq "."
  4. To obtain your cloud account ID, examine the response.
  5. Assign the cloud account ID variable to your cloud account ID.
    cloud_account_id='<your_cloud_account_id>'
  6. List all cloud accounts.
    curl -X GET $url/iaas/api/cloud-accounts?apiVersion=$api_version -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token"  | jq "."
  7. (Optional) To look up the cloud account you created, list the cloud account with your cloud account ID.
    curl -X GET $url/iaas/api/cloud-accounts/$cloud_account_id?apiVersion=$api_version -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" | jq "."
    The response shows the cloud account name and ID for the Amazon Web Services cloud account you created.

Example: Create an Amazon Web Services Cloud Account

Assign the required variables.

Note: If your organization uses an API service that is hosted outside of the United States, your URL variable must include a country abbreviation. See Regional Endpoints for VMware Aria Automation APIs.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2021-07-15'
$ aws_access_key_id='FEDCBA5JJ2F43TUVW7XA'
$ aws_secret_access_key='XYZfGo0/Vb5XPezeC58QRSvLMNOwsHhuB2IbEJxL'

Create a cloud account named demo-aws-account without default cloud zones.

$ curl -X POST \
  "$url/iaas/api/cloud-accounts?apiVersion=$api_version" \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $access_token" \
  -d '{
    "privateKeyId": "'$aws_access_key_id'",
    "cloudAccountType": "aws",
    "name": "demo-aws-account",
    "description": "This is a demo AWS cloud account without cloud zones",
    "regionIds": [ "us-east-1", "us-west-1" ],
    "privateKey": "'$aws_secret_access_key'"
  }' | jq "."

A snippet of the response from your request shows the account ID.

...      
"tags": [],
"name": "demo-aws-account",
"id": "c8c3c9bfdb449475-7f703c5265a63d87-f8e705d89b2569e1aac66c6d00bf4fc7ef4b1c44100f0e944af31eb8ba3d2a5a-f4226a20b65c4675574bc5fbff6c0",
"updatedAt": "2022-04-02",
"organizationId": "8327d53f-91ea-420a-8613-ba8f3149db95",
...