app.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 core
  9. from aws_gamelift.aws_gamelift_construct import AWSGameLift
  10. """Configuration"""
  11. REGION = os.environ.get('O3DE_AWS_DEPLOY_REGION', os.environ.get('CDK_DEFAULT_REGION'))
  12. ACCOUNT = os.environ.get('O3DE_AWS_DEPLOY_ACCOUNT', os.environ.get('CDK_DEFAULT_ACCOUNT'))
  13. # Set the common prefix to group stacks in a project together.
  14. PROJECT_NAME = os.environ.get('O3DE_AWS_PROJECT_NAME', f'O3DE-AWS-PROJECT').upper()
  15. # The name of this feature
  16. FEATURE_NAME = 'AWSGameLift'
  17. # The name of this CDK application
  18. PROJECT_FEATURE_NAME = f'{PROJECT_NAME}-{FEATURE_NAME}'
  19. # Standard Tag Key for project based tags
  20. O3DE_PROJECT_TAG_NAME = 'O3DEProject'
  21. # Standard Tag Key for feature based tags
  22. O3DE_FEATURE_TAG_NAME = 'O3DEFeature'
  23. """End of Configuration"""
  24. # Set-up regions to deploy stack to, or use default if not set
  25. env = core.Environment(
  26. account=ACCOUNT,
  27. region=REGION)
  28. app = core.App()
  29. feature_struct = AWSGameLift(
  30. app,
  31. id_=PROJECT_FEATURE_NAME,
  32. project_name=PROJECT_NAME,
  33. feature_name=FEATURE_NAME,
  34. tags={O3DE_PROJECT_TAG_NAME: PROJECT_NAME, O3DE_FEATURE_TAG_NAME: FEATURE_NAME},
  35. env=env
  36. )
  37. app.synth()