def __init__()

in app.py [0:0]


  def __init__(self, scope:Construct, id:str, vpc:ec2.IVpc, subnet_group_name:str='Private')->None:
    super().__init__(scope, id)

    self.security_group = ec2.SecurityGroup(self, 'SecurityGroup',
      vpc=vpc,
      allow_all_outbound=True)

    for port,name in [(2049,'NFS')]:
      self.security_group.add_ingress_rule(
        peer=ec2.Peer.ipv4(vpc.vpc_cidr_block),
        connection=ec2.Port.tcp(port),
        description='Allow traffic to %s' % name)

    self.filesystem = efs.FileSystem(self,'LinuxFileSystem',
      vpc = vpc,
      enable_automatic_backups=True,
      file_system_name='efs.%s' % DIRECTORY_NAME,
      security_group= self.security_group,
      vpc_subnets= ec2.SubnetSelection(subnet_group_name=subnet_group_name),
      lifecycle_policy=efs.LifecyclePolicy.AFTER_14_DAYS,
      removal_policy= cdk.RemovalPolicy.DESTROY)

    '''
    Configure the DataSync Location.
    '''
    subnets = list(vpc.select_subnets(subnet_group_name=subnet_group_name).subnets)
    self.datasync_location = ds.CfnLocationEFS(self,'EFS-Location',
      efs_filesystem_arn= self.filesystem.file_system_arn,
      ec2_config=ds.CfnLocationEFS.Ec2ConfigProperty(
        security_group_arns=[ DataSyncConstruct.sg_arn(self.security_group) ],
        subnet_arn=DataSyncConstruct.subnet_arn(subnets[0])))