app.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python3
  2. """
  3. Copyright (c) Contributors to the Open 3D Engine Project.
  4. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. SPDX-License-Identifier: Apache-2.0 OR MIT
  6. """
  7. import os
  8. from aws_cdk import (
  9. App, Environment
  10. )
  11. from aws_gamelift.aws_gamelift_construct import AWSGameLift
  12. """Configuration"""
  13. REGION = os.environ.get('O3DE_AWS_DEPLOY_REGION', os.environ.get('CDK_DEFAULT_REGION'))
  14. ACCOUNT = os.environ.get('O3DE_AWS_DEPLOY_ACCOUNT', os.environ.get('CDK_DEFAULT_ACCOUNT'))
  15. # Set the common prefix to group stacks in a project together.
  16. PROJECT_NAME = os.environ.get('O3DE_AWS_PROJECT_NAME', f'O3DE-AWS-PROJECT').upper()
  17. # The name of this feature
  18. FEATURE_NAME = 'AWSGameLift'
  19. # The name of this CDK application
  20. PROJECT_FEATURE_NAME = f'{PROJECT_NAME}-{FEATURE_NAME}'
  21. # Standard Tag Key for project based tags
  22. O3DE_PROJECT_TAG_NAME = 'O3DEProject'
  23. # Standard Tag Key for feature based tags
  24. O3DE_FEATURE_TAG_NAME = 'O3DEFeature'
  25. """End of Configuration"""
  26. # Set-up regions to deploy stack to, or use default if not set
  27. env = Environment(
  28. account=ACCOUNT,
  29. region=REGION)
  30. app = App()
  31. feature_struct = AWSGameLift(
  32. app,
  33. id_=PROJECT_FEATURE_NAME,
  34. project_name=PROJECT_NAME,
  35. feature_name=FEATURE_NAME,
  36. tags={O3DE_PROJECT_TAG_NAME: PROJECT_NAME, O3DE_FEATURE_TAG_NAME: FEATURE_NAME},
  37. env=env
  38. )
  39. app.synth()