in enginframe_aurora_serverless/efs.py [0:0]
def __init__(self, scope: cdk.Construct, construct_id: str, vpc, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
security_group = ec2.SecurityGroup(
self,
id="SecurityGroup",
vpc=vpc,
description="EFS SG",
allow_all_outbound=True
)
security_group.add_ingress_rule(ec2.Peer.ipv4(
'10.0.0.0/16'), ec2.Port.tcp(2049), "allow nfs")
self.file_system = efs.FileSystem(self, "EfsFileSystem",
vpc=vpc,
performance_mode=efs.PerformanceMode.GENERAL_PURPOSE,
file_system_name='EnginFrame Shared Storage',
security_group=security_group,
removal_policy=core.RemovalPolicy.DESTROY
)
core.CfnOutput(
self,
id="EfsID",
value=self.file_system.file_system_id,
description="ID of the file system",
export_name=f"{self.region}:{self.account}:{self.stack_name}:efs-id"
)