

# CreateEnvironment

Creates an environment for an Amplify Gen 3 app.

## Request Syntax
<a name="API_CreateEnvironment_RequestSyntax"></a>

```
POST /apps/{{AppName}}/environments HTTP/1.1
Content-type: application/json

{
   "Backend": { 
      "Auth": "{{string}}",
      "Database": { 
         "BackupRetentionDays": {{number}},
         "MaxBackendCapacityUnits": {{number}}
      }
   },
   "EnvironmentName": "{{string}}",
   "EnvironmentRoleArn": "{{string}}",
   "EnvironmentRolePermissionMode": "{{string}}",
   "GradualRolloutConfig": { ... },
   "NetworkConfig": { 
      "BuildNetworkConnectorArn": "{{string}}",
      "ComputeNetworkConnectorArn": "{{string}}"
   },
   "SourceConfig": { ... },
   "Tags": { 
      "{{string}}" : "{{string}}" 
   },
   "Web": { 
      "EnvironmentAliasConfig": { 
         "RoutingMode": "{{string}}"
      },
      "SkewProtectionConfig": { 
         "CookieMaxAgeSeconds": {{number}},
         "Status": "{{string}}"
      }
   }
}
```

## URI Request Parameters
<a name="API_CreateEnvironment_RequestParameters"></a>

The request uses the following URI parameters.

 ** [AppName](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-uri-AppName"></a>
The name of the app.  
Length Constraints: Minimum length of 1. Maximum length of 40.  
Required: Yes

## Request Body
<a name="API_CreateEnvironment_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [Backend](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-Backend"></a>
The backend settings for the environment. You can specify this only when the app has a backend. If you omit this, the default authentication settings and the plan's default database settings are used.  
Type: [EnvironmentBackendConfigRequest](API_EnvironmentBackendConfigRequest.md) object  
Required: No

 ** [EnvironmentName](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-EnvironmentName"></a>
The name of the environment.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 40.  
Required: Yes

 ** [EnvironmentRoleArn](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-EnvironmentRoleArn"></a>
The Amazon Resource Name (ARN) of the IAM role for the environment.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.  
Required: Yes

 ** [EnvironmentRolePermissionMode](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-EnvironmentRolePermissionMode"></a>
The permission mode for the environment's IAM role.  
Type: String  
Valid Values: `SCOPED | FULL`   
Required: No

 ** [GradualRolloutConfig](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-GradualRolloutConfig"></a>
The gradual rollout settings for the environment.  
Type: [GradualRolloutConfig](API_GradualRolloutConfig.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: No

 ** [NetworkConfig](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-NetworkConfig"></a>
The VPC network configuration for the environment.  
Type: [EnvironmentNetworkConfigRequest](API_EnvironmentNetworkConfigRequest.md) object  
Required: No

 ** [SourceConfig](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-SourceConfig"></a>
The source configuration for the environment.  
Type: [EnvironmentSourceConfigRequest](API_EnvironmentSourceConfigRequest.md) object  
 **Note: **This object is a Union. Only one member of this object can be specified or returned.  
Required: No

 ** [Tags](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-Tags"></a>
The tags to apply to the resource.  
Type: String to string map  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `[a-zA-Z0-9 _\.:\/=+\-@]+`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `[a-zA-Z0-9 _\.:\/=+\-@]*`   
Required: No

 ** [Web](#API_CreateEnvironment_RequestSyntax) **   <a name="amplifygen3-CreateEnvironment-request-Web"></a>
The web hosting settings for the environment.  
Type: [EnvironmentWebConfigRequest](API_EnvironmentWebConfigRequest.md) object  
Required: No

## Response Syntax
<a name="API_CreateEnvironment_ResponseSyntax"></a>

```
HTTP/1.1 200
Content-type: application/json

{
   "EnvironmentArn": "string"
}
```

## Response Elements
<a name="API_CreateEnvironment_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [EnvironmentArn](#API_CreateEnvironment_ResponseSyntax) **   <a name="amplifygen3-CreateEnvironment-response-EnvironmentArn"></a>
The Amazon Resource Name (ARN) of the environment.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 512.

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

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

 ** AccessDeniedException **   
You do not have sufficient permissions to perform this action.    
 ** message **   
A message that describes the error.
HTTP Status Code: 403

 ** ConflictException **   
The request conflicts with the current state of the resource.    
 ** message **   
A message that describes the error.
HTTP Status Code: 409

 ** InternalServerException **   
An internal error occurred. Retry the request.    
 ** message **   
A message that describes the error.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The requested resource was not found.    
 ** message **   
A message that describes the error.
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The request would exceed a service quota for your account.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the service quota that was exceeded.  
 ** serviceCode **   
The code of the service that the quota belongs to.
HTTP Status Code: 402

 ** ThrottlingException **   
The request was denied because the request rate exceeds the allowed limit.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the service quota that caused the throttling.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request.  
 ** serviceCode **   
The code of the service that the quota belongs to.
HTTP Status Code: 429

 ** ValidationException **   
The request contains invalid parameters or is otherwise malformed.    
 ** message **   
A message that describes the error.
HTTP Status Code: 400

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

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/amplifygen3-2025-09-18/CreateEnvironment) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/amplifygen3-2025-09-18/CreateEnvironment) 