

# CreateEnvironment

Creates a new governance environment with the specified name and service role. If you provide `identityStore`, AWS Assurance creates an IAM Identity Center managed application for the environment.

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

 ** description **   
A description of the environment.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 512.  
Required: No

 ** domainPrefix **   
The optional custom domain prefix for the environment portal URL. The prefix must be unique within the AWS Region. If you don't specify a prefix, AWS Assurance uses the environment ID. You can't change the prefix after you create the environment.  
Type: String  
Length Constraints: Minimum length of 3. Maximum length of 64.  
Pattern: `[a-z][a-z0-9-]{1,62}[a-z0-9]`   
Required: No

 ** environmentName **   
The name of the environment.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[a-zA-Z0-9._-]+`   
Required: Yes

 ** environmentScope **   
The set of AWS accounts that the new environment evaluates. If you omit the scope, AWS Assurance uses `SINGLE_ACCOUNT`. Valid values:  
+  `ORGANIZATION` – Evaluates the member accounts in your organization in AWS Organizations. Call this operation from the management account or a delegated administrator account, with trusted access for AWS Assurance turned on.
+  `SINGLE_ACCOUNT` – Evaluates only the account where you create the environment.
Type: String  
Valid Values: `ORGANIZATION | SINGLE_ACCOUNT`   
Required: No

 ** identityStore **   
The identity store configuration.  
Type: [IdentityStoreConfig](API_IdentityStoreConfig.md) object  
Required: No

 ** kmsKeyArn **   
The ARN of an optional AWS KMS key that encrypts evidence. The AWS Assurance service role must have `kms:Decrypt` and `kms:GenerateDataKey` permissions on this key.  
Type: String  
Length Constraints: Minimum length of 20. Maximum length of 2048.  
Pattern: `arn:aws[a-zA-Z-]*:kms:[a-z0-9-]+:[0-9]{12}:key/[a-zA-Z0-9-]+`   
Required: No

 ** operatorRole **   
The AWS Identity and Access Management (IAM) role that AWS Assurance assumes to issue temporary credentials to operators who use your application. You must specify this role to support operator sessions. The role's trust policy must allow the AWS Assurance service principal to call `sts:AssumeRole`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 256.  
Pattern: `arn:aws[a-zA-Z-]*:iam::[0-9]{12}:role/.+`   
Required: No

 ** organizationalUnitIds **   
The organizational units to scope the organization environment's evaluation to. Only valid when the environment scope is ORGANIZATION. When omitted, the entire organization is in scope. Must contain at least one OU when provided. Accounts in nested OUs under a listed OU are included.  
Type: Array of strings  
Array Members: Minimum number of 1 item. Maximum number of 10 items.  
Length Constraints: Minimum length of 16. Maximum length of 68.  
Pattern: `ou-[0-9a-z]{4,32}-[0-9a-z]{8,32}`   
Required: No

 ** regions **   
The AWS Regions to evaluate across. When empty or omitted, the environment evaluates all generally available Regions in the partition. Applies to all accounts in scope.  
Type: Array of strings  
Array Members: Minimum number of 0 items. Maximum number of 50 items.  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Required: No

 ** tags **   
The tags attached to the resource, as key-value pairs.  
Type: Array of [Tag](API_Tag.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 50 items.  
Required: No

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

The following element is returned by the service.

 ** environmentArn **   
The ARN of the newly created governance environment.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 512.  
Pattern: `arn:.+` 

## 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 access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.  
HTTP Status Code: 403

 ** ConflictException **   
A conflict occurred (for example, resource already exists).  
HTTP Status Code: 409

 ** InternalServerException **   
An internal server error occurred.  
HTTP Status Code: 500

 ** ThrottlingException **   
The request was throttled.  
HTTP Status Code: 429

 ** ValidationException **   
The request failed validation.  
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/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/assurance-2022-07-26/CreateEnvironment) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/assurance-2022-07-26/CreateEnvironment) 