How to use nested_stacks method in localstack

Best Python code snippet using localstack_python

consoleme_ecs_service_stack.py

Source:consoleme_ecs_service_stack.py Github

copy

Full Screen

1"""2Main account stack for running ConsoleMe on ECS3"""4from aws_cdk import (5 core as cdk6)7from nested_stacks.shared_stack import SharedStack8from nested_stacks.iam_stack import IAMStack9from nested_stacks.vpc_stack import VPCStack10from nested_stacks.alb_stack import ALBStack11from nested_stacks.compute_stack import ComputeStack12from nested_stacks.cache_stack import CacheStack13from nested_stacks.domain_stack import DomainStack14from nested_stacks.db_stack import DBStack15from nested_stacks.auth_stack import AuthStack16from nested_stacks.config_stack import ConfigStack17from constants import BASE_NAME18class ConsolemeEcsServiceStack(cdk.Stack):19 """Main stack for the ConsoleMe service.20 Attributes:21 flight_speed The maximum speed that such a bird can attain.22 nesting_grounds The locale where these birds congregate to reproduce.23 """24 def __init__(self, scope: cdk.Construct, id: str, **kwargs) -> None:25 super().__init__(scope, id, **kwargs)26 shared_stack = SharedStack(27 self,28 'Shared'29 )30 iam_stack = IAMStack(31 self,32 'IAM',33 s3_bucket=shared_stack.s3_bucket34 )35 DBStack(36 self,37 'DB'38 )39 vpc_stack = VPCStack(40 self,41 'VPC'42 )43 alb_stack = ALBStack(44 self,45 'ALB',46 vpc=vpc_stack.vpc,47 consoleme_sg=vpc_stack.consoleme_sg48 )49 domain_stack = DomainStack(50 self,51 'Domain',52 consoleme_alb=alb_stack.consoleme_alb53 )54 auth_stack = AuthStack(55 self,56 'Auth',57 domain_name=domain_stack.route53_record.domain_name58 )59 cache_stack = CacheStack(60 self,61 'Cache',62 vpc=vpc_stack.vpc,63 redis_sg=vpc_stack.redis_sg64 )65 config_stack = ConfigStack(66 self,67 'Config',68 cognito_user_pool=auth_stack.cognito_user_pool,69 redis=cache_stack.redis,70 domain_name=domain_stack.route53_record.domain_name,71 s3_bucket_name=shared_stack.s3_bucket.bucket_name,72 create_configuration_lambda_role_arn=iam_stack.create_configuration_lambda_role.role_arn73 )74 compute_stack = ComputeStack(75 self,76 'Compute',77 vpc=vpc_stack.vpc,78 consoleme_alb=alb_stack.consoleme_alb,79 consoleme_sg=vpc_stack.consoleme_sg,80 s3_bucket_name=shared_stack.s3_bucket.bucket_name,81 certificate=domain_stack.certificate,82 task_role_arn=iam_stack.ecs_task_role.role_arn,83 task_execution_role_arn=iam_stack.ecs_task_execution_role.role_arn84 )85 compute_stack.node.add_dependency(config_stack)86 # Output the service URL to CloudFormation outputs87 cdk.CfnOutput(88 self,89 f'{BASE_NAME}URL',90 value='https://' + domain_stack.route53_record.domain_name...

Full Screen

Full Screen

nested-stacks.py

Source:nested-stacks.py Github

copy

Full Screen

1import argparse2from colorama import Fore, init3class NestedStacks:4 """5 Creates an S3 bucket to store CloudFormation Nested Stacks (reusable templates)6 """7 def __init__(self, bucket):8 """9 Initializes this instance of NestedStacks10 :param bucket: S3 bucket name11 """12 self.bucket = bucket13 def setup(self):14 """15 Creates an S3 bucket to store CloudFormation Nested Stacks16 """17 utils.s3.create_bucket(self.bucket)18 def teardown(self):19 """20 :return:21 """22 utils.s3.delete_bucket(self.bucket)23if __name__ == '__main__':24 if __package__ is None:25 import sys26 from os import path27 sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))28 from utils.logging import log_error29 import utils.s330 # Initializing colorama because this method is currently being called31 # as a top-level script and not a module.32 init()33 else:34 from utils.logging import log_error35 import utils.s336 parser = argparse.ArgumentParser(description="Adds or removes S3 bucket to hold Cloudformation Nested Stacks.")37 command_group = parser.add_mutually_exclusive_group()38 command_group.add_argument("-s", "--setup", help="Adds the S3 bucket to the account.", action="store_true")39 command_group.add_argument("-t", "--teardown", help="Removes the S3 bucket from the account.", action="store_true")40 parser.add_argument("--bucket", required=True, action="store", dest="bucket", help="S3 bucket name")41 args = parser.parse_args()42 nested_stacks = NestedStacks(args.bucket)43 if args.setup:44 nested_stacks.setup()45 elif args.teardown:46 nested_stacks.teardown()47 else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful