

# RebuildEnvironment
<a name="API_RebuildEnvironment"></a>

Deletes and recreates all of the Amazon resources (for example: the Auto Scaling group, load balancer, etc.) for a specified environment and forces a restart.

## Request Parameters
<a name="API_RebuildEnvironment_RequestParameters"></a>

 For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

 ** EnvironmentId **   
The ID of the environment to rebuild.  
 Condition: You must specify either this or an EnvironmentName, or both. If you do not specify either, Amazon Elastic Beanstalk returns `MissingRequiredParameter` error.   
Type: String  
Required: No

 ** EnvironmentName **   
The name of the environment to rebuild.  
 Condition: You must specify either this or an EnvironmentId, or both. If you do not specify either, Amazon Elastic Beanstalk returns `MissingRequiredParameter` error.   
Type: String  
Length Constraints: Minimum length of 4. Maximum length of 40.  
Required: No

## Errors
<a name="API_RebuildEnvironment_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** InsufficientPrivileges **   
The specified account does not have sufficient privileges for one or more Amazon services.  
HTTP Status Code: 403

## Examples
<a name="API_RebuildEnvironment_Examples"></a>

### Example
<a name="API_RebuildEnvironment_Example_1"></a>

This example illustrates one usage of RebuildEnvironment.

#### Sample Request
<a name="API_RebuildEnvironment_Example_1_Request"></a>

```
https://elasticbeanstalk.us-west-2.amazonaws.com/?EnvironmentId=e-hc8mvnayrx
&EnvironmentName=SampleAppVersion
&Operation=RebuildEnvironment
&AuthParams
```

#### Sample Response
<a name="API_RebuildEnvironment_Example_1_Response"></a>

```
<RebuildEnvironmentResponse xmlns="https://elasticbeanstalk.amazonaws.com/docs/2010-12-01/">
  <ResponseMetadata>
    <RequestId>a7d6606e-f289-11df-8a78-9f77047e0d0c</RequestId>
  </ResponseMetadata>
</RebuildEnvironmentResponse>
```

## See Also
<a name="API_RebuildEnvironment_SeeAlso"></a>

For more information about using this API in one of the language-specific Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for C\$1\$1](https://docs.amazonaws.cn/goto/SdkForCpp/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for Python](https://docs.amazonaws.cn/goto/boto3/elasticbeanstalk-2010-12-01/RebuildEnvironment) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/elasticbeanstalk-2010-12-01/RebuildEnvironment) 