class_docstr: AWS environment.
docstr: Create an AWS environment from the default AWS environment.
  
  Arguments:
      region (str, optional): The AWS region.
      verify (bool, optional): Whether to verify the AWS environment. Defaults to True.
  
  Returns:
      AwsEnvironment: The AWS environment.
docstr_tok: ["Create","an","AWS","environment","from","the","default","AWS","environment",".","Arguments",":","region","(","str",",","optional",")",":","The","AWS","region",".","verify","(","bool",",","optional",")",":","Whether","to","verify","the","AWS","environment",".","Defaults","to","True",".","Returns",":","AwsEnvironment",":","The","AWS","environment","."]
code: def from_default(
      cls, region: Optional[str] = None
  ) -> "AwsEnvironment":
      """Create an AWS environment from the default AWS environment.
  
      Arguments:
          region (str, optional): The AWS region.
          verify (bool, optional): Whether to verify the AWS environment. Defaults to True.
  
      Returns:
          AwsEnvironment: The AWS environment.
      """
      _logger.info("Creating AWS environment from default credentials.")
      try:
          session = boto3.Session()
          if hasattr(session, "region"):
              region = region or session.region
          region = region or os.environ.get("AWS_REGION")
          credentials = session.get_credentials()
          if not credentials:
              raise LaunchError(
                  "Could not create AWS environment from default environment. Please verify that your AWS credentials are configured correctly."
              )
          access_key = credentials.access_key
          secret_key = credentials.secret_key
          session_token = credentials.token
      except botocore.client.ClientError as e:
          raise LaunchError(
              f"Could not create AWS environment from default environment. Please verify that your AWS credentials are configured correctly. {e}"
          )
      if not region:
          raise LaunchError(
              "Could not create AWS environment from default environment. Region not specified."
          )
      return cls(
          region=region,
          access_key=access_key,
          secret_key=secret_key,
          session_token=session_token,
      )
  
file_path: wandb/wandb/sdk/launch/environment/aws_environment.py
imports: import logging
  import os
  from typing import Dict, Optional
  from wandb.sdk.launch.errors import LaunchError
  from wandb.util import get_module
  from ..utils import S3_URI_RE, event_loop_thread_exec
  from .abstract import AbstractEnvironment
label_desc: Use image node_id 2 for calling the AwsEnvironment obj's underlying member method code with example usage: obj.from_default(cls, region) and returns: cls