Skip to content

EfsConfig

Bases: BaseModel, NameValidationMixin

Configuration model for AWS EFS (Elastic File System) file systems.

Comprehensive configuration model that defines all aspects of an EFS file system including performance characteristics, throughput modes, encryption settings, access point configurations, and lifecycle management policies. This model validates EFS configuration parameters, ensures optimal performance settings, and enforces organizational standards for EFS deployments including naming conventions, security requirements, and access control patterns.

EFS provides scalable, fully managed NFS file systems for use with AWS services and on-premises resources. This configuration model supports both general-purpose and high-performance workloads with configurable throughput modes and multiple access points for fine-grained access control.

Attributes:

Name Type Description
efs_base_name str

Base name for the EFS file system resource

removal_policy str

CDK removal policy for resource cleanup behavior

performance_mode Optional[str]

EFS performance mode (GeneralPurpose or MaxIO)

throughput_mode Optional[str]

EFS throughput mode (Bursting or Provisioned)

encrypted bool

Whether to enable encryption at rest for the file system

access_points Optional[List[EfsAccessPointConfig]]

List of access point configurations for controlled access

use_foundation_key bool

Use organizational KMS key from foundation infrastructure

Source code in mare_aws_common_lib/models/efs_config.py
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
class EfsConfig(BaseModel, NameValidationMixin):
    """Configuration model for AWS EFS (Elastic File System) file systems.

    Comprehensive configuration model that defines all aspects of an EFS file system
    including performance characteristics, throughput modes, encryption settings,
    access point configurations, and lifecycle management policies. This model
    validates EFS configuration parameters, ensures optimal performance settings,
    and enforces organizational standards for EFS deployments including naming
    conventions, security requirements, and access control patterns.

    EFS provides scalable, fully managed NFS file systems for use with AWS services
    and on-premises resources. This configuration model supports both general-purpose
    and high-performance workloads with configurable throughput modes and multiple
    access points for fine-grained access control.

    Attributes:
        efs_base_name: Base name for the EFS file system resource
        removal_policy: CDK removal policy for resource cleanup behavior
        performance_mode: EFS performance mode (GeneralPurpose or MaxIO)
        throughput_mode: EFS throughput mode (Bursting or Provisioned)
        encrypted: Whether to enable encryption at rest for the file system
        access_points: List of access point configurations for controlled access
        use_foundation_key: Use organizational KMS key from foundation infrastructure
    """
    model_config = ConfigDict(extra="forbid")

    efs_base_name: str = Field(..., description="The base name of the EFS file system")
    removal_policy: str = Field(default="DESTROY", description="Removal policy for the EFS file system")
    performance_mode: Optional[str] = Field(
        default=None,
        description="Performance mode for the EFS (GeneralPurpose or MaxIO)"
    )
    throughput_mode: Optional[str] = Field(
        default=None,
        description="Throughput mode for the EFS (Bursting or Provisioned)"
    )
    encrypted: bool = Field(default=False, description="Whether to encrypt the EFS")
    access_points: Optional[List[EfsAccessPointConfig]] = Field(
        default_factory=list,
        description="List of access point configurations"
    )
    use_foundation_key: bool = Field(default=True, description="Whether to use the KMS SNC key from the foundation")

    @field_validator("efs_base_name")
    @classmethod
    def validate_ap_name(cls, value):
        """Validate the EFS base name.

        Applies organizational naming standards to EFS file system names to ensure
        consistency and compliance with AWS resource naming requirements.

        Args:
            value: Raw EFS base name from configuration

        Returns:
            Validated EFS base name

        Raises:
            ValueError: If the EFS base name fails validation rules
        """
        return cls.validate_name(value)

    @field_validator("removal_policy")
    @classmethod
    def validate_removal_policy(cls, value):
        """Validate the CDK removal policy.

        Ensures the removal policy string matches a valid CDK RemovalPolicy
        enum value for proper resource cleanup behavior.

        Args:
            value: Removal policy string from configuration

        Returns:
            Validated removal policy string

        Raises:
            ValueError: If the removal policy is not a valid CDK RemovalPolicy value
        """
        if value is not None:
            try:
                getattr(RemovalPolicy, value.upper())
            except:
                valid_values = [attr for attr in dir(RemovalPolicy) if not attr.startswith("_")]
                raise ValueError(f"removal_policy must be one of: {valid_values}")
        return value

    @field_validator("performance_mode")
    @classmethod
    def validate_performance_mode(cls, value):
        """Validate the EFS performance mode.

        Ensures the performance mode string matches a valid EFS PerformanceMode
        enum value for optimal file system performance configuration.

        Args:
            value: Performance mode string from configuration

        Returns:
            Validated performance mode string

        Raises:
            ValueError: If the performance mode is not a valid EFS PerformanceMode value
        """
        if value is not None:
            try:
                getattr(efs.PerformanceMode, value.upper())
            except AttributeError:
                valid_values = [attr for attr in dir(efs.PerformanceMode) if not attr.startswith("_")]
                raise ValueError(f"performance_mode must be one of: {valid_values}")
        return value

    @field_validator("throughput_mode")
    @classmethod
    def validate_throughput_mode(cls, value):
        """Validate the EFS throughput mode.

        Ensures the throughput mode string matches a valid EFS ThroughputMode
        enum value for proper bandwidth configuration.

        Args:
            value: Throughput mode string from configuration

        Returns:
            Validated throughput mode string

        Raises:
            ValueError: If the throughput mode is not a valid EFS ThroughputMode value
        """
        if value is not None:
            try:
                getattr(efs.ThroughputMode, value.upper())
            except AttributeError:
                valid_values = [attr for attr in dir(efs.ThroughputMode) if not attr.startswith("_")]
                raise ValueError(f"throughput_mode must be one of: {valid_values}")
        return value

    def get_performance_mode(self) -> efs.PerformanceMode:
        """Convert string to CDK PerformanceMode enum.

        Transforms the string-based performance mode configuration into
        the corresponding CDK PerformanceMode enum for use in infrastructure code.

        Returns:
            CDK PerformanceMode enum value, defaults to GENERAL_PURPOSE if not specified
        """
        if self.performance_mode:
            return getattr(efs.PerformanceMode, self.performance_mode)
        return efs.PerformanceMode.GENERAL_PURPOSE  # default

    def get_throughput_mode(self) -> efs.ThroughputMode:
        """Convert string to CDK ThroughputMode enum.

        Transforms the string-based throughput mode configuration into
        the corresponding CDK ThroughputMode enum for use in infrastructure code.

        Returns:
            CDK ThroughputMode enum value, defaults to BURSTING if not specified
        """
        if self.throughput_mode:
            return getattr(efs.ThroughputMode, self.throughput_mode)
        return efs.ThroughputMode.BURSTING

    def get_removal_policy(self) -> RemovalPolicy:
        """Convert string to CDK RemovalPolicy enum.

        Transforms the string-based removal policy configuration into
        the corresponding CDK RemovalPolicy enum for use in infrastructure code.

        Returns:
            CDK RemovalPolicy enum value
        """
        return getattr(RemovalPolicy, self.removal_policy.upper())

get_performance_mode()

Convert string to CDK PerformanceMode enum.

Transforms the string-based performance mode configuration into the corresponding CDK PerformanceMode enum for use in infrastructure code.

Returns:

Type Description
PerformanceMode

CDK PerformanceMode enum value, defaults to GENERAL_PURPOSE if not specified

Source code in mare_aws_common_lib/models/efs_config.py
263
264
265
266
267
268
269
270
271
272
273
274
def get_performance_mode(self) -> efs.PerformanceMode:
    """Convert string to CDK PerformanceMode enum.

    Transforms the string-based performance mode configuration into
    the corresponding CDK PerformanceMode enum for use in infrastructure code.

    Returns:
        CDK PerformanceMode enum value, defaults to GENERAL_PURPOSE if not specified
    """
    if self.performance_mode:
        return getattr(efs.PerformanceMode, self.performance_mode)
    return efs.PerformanceMode.GENERAL_PURPOSE  # default

get_removal_policy()

Convert string to CDK RemovalPolicy enum.

Transforms the string-based removal policy configuration into the corresponding CDK RemovalPolicy enum for use in infrastructure code.

Returns:

Type Description
RemovalPolicy

CDK RemovalPolicy enum value

Source code in mare_aws_common_lib/models/efs_config.py
289
290
291
292
293
294
295
296
297
298
def get_removal_policy(self) -> RemovalPolicy:
    """Convert string to CDK RemovalPolicy enum.

    Transforms the string-based removal policy configuration into
    the corresponding CDK RemovalPolicy enum for use in infrastructure code.

    Returns:
        CDK RemovalPolicy enum value
    """
    return getattr(RemovalPolicy, self.removal_policy.upper())

get_throughput_mode()

Convert string to CDK ThroughputMode enum.

Transforms the string-based throughput mode configuration into the corresponding CDK ThroughputMode enum for use in infrastructure code.

Returns:

Type Description
ThroughputMode

CDK ThroughputMode enum value, defaults to BURSTING if not specified

Source code in mare_aws_common_lib/models/efs_config.py
276
277
278
279
280
281
282
283
284
285
286
287
def get_throughput_mode(self) -> efs.ThroughputMode:
    """Convert string to CDK ThroughputMode enum.

    Transforms the string-based throughput mode configuration into
    the corresponding CDK ThroughputMode enum for use in infrastructure code.

    Returns:
        CDK ThroughputMode enum value, defaults to BURSTING if not specified
    """
    if self.throughput_mode:
        return getattr(efs.ThroughputMode, self.throughput_mode)
    return efs.ThroughputMode.BURSTING

validate_ap_name(value) classmethod

Validate the EFS base name.

Applies organizational naming standards to EFS file system names to ensure consistency and compliance with AWS resource naming requirements.

Parameters:

Name Type Description Default
value

Raw EFS base name from configuration

required

Returns:

Type Description

Validated EFS base name

Raises:

Type Description
ValueError

If the EFS base name fails validation rules

Source code in mare_aws_common_lib/models/efs_config.py
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@field_validator("efs_base_name")
@classmethod
def validate_ap_name(cls, value):
    """Validate the EFS base name.

    Applies organizational naming standards to EFS file system names to ensure
    consistency and compliance with AWS resource naming requirements.

    Args:
        value: Raw EFS base name from configuration

    Returns:
        Validated EFS base name

    Raises:
        ValueError: If the EFS base name fails validation rules
    """
    return cls.validate_name(value)

validate_performance_mode(value) classmethod

Validate the EFS performance mode.

Ensures the performance mode string matches a valid EFS PerformanceMode enum value for optimal file system performance configuration.

Parameters:

Name Type Description Default
value

Performance mode string from configuration

required

Returns:

Type Description

Validated performance mode string

Raises:

Type Description
ValueError

If the performance mode is not a valid EFS PerformanceMode value

Source code in mare_aws_common_lib/models/efs_config.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
@field_validator("performance_mode")
@classmethod
def validate_performance_mode(cls, value):
    """Validate the EFS performance mode.

    Ensures the performance mode string matches a valid EFS PerformanceMode
    enum value for optimal file system performance configuration.

    Args:
        value: Performance mode string from configuration

    Returns:
        Validated performance mode string

    Raises:
        ValueError: If the performance mode is not a valid EFS PerformanceMode value
    """
    if value is not None:
        try:
            getattr(efs.PerformanceMode, value.upper())
        except AttributeError:
            valid_values = [attr for attr in dir(efs.PerformanceMode) if not attr.startswith("_")]
            raise ValueError(f"performance_mode must be one of: {valid_values}")
    return value

validate_removal_policy(value) classmethod

Validate the CDK removal policy.

Ensures the removal policy string matches a valid CDK RemovalPolicy enum value for proper resource cleanup behavior.

Parameters:

Name Type Description Default
value

Removal policy string from configuration

required

Returns:

Type Description

Validated removal policy string

Raises:

Type Description
ValueError

If the removal policy is not a valid CDK RemovalPolicy value

Source code in mare_aws_common_lib/models/efs_config.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@field_validator("removal_policy")
@classmethod
def validate_removal_policy(cls, value):
    """Validate the CDK removal policy.

    Ensures the removal policy string matches a valid CDK RemovalPolicy
    enum value for proper resource cleanup behavior.

    Args:
        value: Removal policy string from configuration

    Returns:
        Validated removal policy string

    Raises:
        ValueError: If the removal policy is not a valid CDK RemovalPolicy value
    """
    if value is not None:
        try:
            getattr(RemovalPolicy, value.upper())
        except:
            valid_values = [attr for attr in dir(RemovalPolicy) if not attr.startswith("_")]
            raise ValueError(f"removal_policy must be one of: {valid_values}")
    return value

validate_throughput_mode(value) classmethod

Validate the EFS throughput mode.

Ensures the throughput mode string matches a valid EFS ThroughputMode enum value for proper bandwidth configuration.

Parameters:

Name Type Description Default
value

Throughput mode string from configuration

required

Returns:

Type Description

Validated throughput mode string

Raises:

Type Description
ValueError

If the throughput mode is not a valid EFS ThroughputMode value

Source code in mare_aws_common_lib/models/efs_config.py
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
@field_validator("throughput_mode")
@classmethod
def validate_throughput_mode(cls, value):
    """Validate the EFS throughput mode.

    Ensures the throughput mode string matches a valid EFS ThroughputMode
    enum value for proper bandwidth configuration.

    Args:
        value: Throughput mode string from configuration

    Returns:
        Validated throughput mode string

    Raises:
        ValueError: If the throughput mode is not a valid EFS ThroughputMode value
    """
    if value is not None:
        try:
            getattr(efs.ThroughputMode, value.upper())
        except AttributeError:
            valid_values = [attr for attr in dir(efs.ThroughputMode) if not attr.startswith("_")]
            raise ValueError(f"throughput_mode must be one of: {valid_values}")
    return value