having issue creating AWS Elastic with VPC via API call
Asked by William Flow:

Ok so here is my issue:

using Post Man i am try to write code that will

Create elastic image configuration, it does work but i need to use a VPC when I spec out the VPC in subnets i get an error

This works:  
**{**  
**"configurationName": "Test-bill2",**  
**"configurationDescription": "AAP Test",**  
**"imageId": "ami-0ebba1413ed727061",**  
**"ebsEnabled": false,**  
**"instanceType": "M3Large",**  
**"product": "Linux/UNIX",**  
**"architecture": "x86_64",**  
**"region": "us-gov-west-1",**  
**}**  
The problem is i use a VPC and I can't see where i set that so I tried:  

**{**  
**"configurationName": "Test-bill3",**  
**"configurationDescription": "AAP Test",**  
**"imageId": "ami-0ebba1413ed727061",**  
**"ebsEnabled": false,**  
**"instanceType": "M3Large",**  
**"product": "Linux/UNIX",**  
**"architecture": "x86_64",**  
**"region": "us-gov-west-1",**  
**"subnetIds": \[**  
**"subnet-88c0f4ec"**  
**\]**  
**}**  
and i get back  
**{**  
**"message": "Unrecognized field \\"subnetIds\\" (Class com.atlassian.bamboo.plugins.rest.model.elasticConfig.RestElasticImageConfig), not marked as ignorable\\n at \[Source: org.apache.catalina.connector.CoyoteInputStream@3fe18880; line: 10, column: 17\] (through reference chain: com.atlassian.bamboo.plugins.rest.model.elasticConfig.RestElasticImageConfig\[\\"subnetIds\\"\])",**  
**"status-code": 400**  
**}**  
i also tried setting the subnet to the VPC still no joy and cant find any examples  
Thanks in advance  

Bill


Answers:
author: Eduardo Alvarenga
body: Hello [@William Flow](/t5/user/viewprofilepage/user-id/4551025)

There's a bug in the REST API documentation, please use "**subnetId** " instead (singular). It is also the case in "**availabilityZone**".

You always call a GET o the "[/rest/api/latest/elasticConfiguration](https://developer.atlassian.com/server/bamboo/rest/api-group-api/#api-api-latest-elasticconfiguration-get)" endpoint to list all the available options and their format.

Thank you,

Eduardo Alvarenga  
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful--

comments: author: William Flow
body: no joy but get a different error body i sent  
{  
"configurationName": "Test-bill67",  
"configurationDescription": "AAP Test",  
"imageId": "ami-0ebba1413ed727061",  
"ebsEnabled": false,  
"instanceType": "M3Large",  
"product": "Linux/UNIX",  
"architecture": "x86_64",  
"region": "us-gov-west-1",  
"subnetId": \[  
"subnet-3ac9fd5e"  
\],  
"availabilityZone": \[  
"us-gov-west-1a"  
\]  
}  
got back  
{  
"message": "Can not deserialize instance of java.lang.String out of START_ARRAY token\\n at \[Source: org.apache.catalina.connector.CoyoteInputStream@3fe18880; line: 9, column: 28\] (through reference chain: com.atlassian.bamboo.plugins.rest.model.elasticConfig.RestElasticImageConfig\[\\"subnetId\\"\])",  
"status-code": 400  
}


author: William Flow
body: never mind I fixed it this works

{  
"configurationName": "Test-bill68",  
"configurationDescription": "AAP Test",  
"imageId": "ami-0ebba1413ed727061",  
"ebsEnabled": false,  
"instanceType": "M3Large",  
"product": "Linux/UNIX",  
"architecture": "x86_64",  
"region": "us-gov-west-1",  
"availabilityZone": "us-gov-west-1a,us-gov-west-1b",  
"subnetId": "subnet-88c0f4ec,subnet-63764615"  
}


author: Eduardo Alvarenga
body: Hello [@William Flow](/t5/user/viewprofilepage/user-id/4551025)

Thanks for reporting that. We have opened a bug to track that fix. You can watch it to follow its progress.

* [BAM-22122: The REST API elasticConfiguration endpoint has incorrect sample syntax for POST and PUT methods](https://jira.atlassian.com/browse/BAM-22122)

Cheers,

Eduardo Alvarenga  
Atlassian Support APAC

**--please don't forget to Accept the answer if the reply is helpful--**


Tags: rest-api