-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(aws-efs): EFS FileSystem construction always fails when passing both lifecyclePolicy and outOfInfrequentAccessPolicy #19058
Description
What is the problem?
When deploying an example in the official CDK document, EFS creation always fails with the following error:
One or more LifecyclePolicy objects specified are malformed.
After some investigation, I have found that setting both lifecyclePolicy and outOfInfrequentAccessPolicy is the cause of the problem. When you pass only one of them to a construct, it successfully deployed to AWS.
I assume that means CloudFormation template does not allow multiple entries in one LifecyclePolicies item. So, I have not confirmed though, the following changes to emitted CloudFormation template may work.
Bad
"LifecyclePolicies": [
{
"TransitionToIA": "AFTER_14_DAYS",
"TransitionToPrimaryStorageClass": "AFTER_1_ACCESS"
}
],Good
"LifecyclePolicies": [
{
"TransitionToIA": "AFTER_14_DAYS"
},
{
"TransitionToPrimaryStorageClass": "AFTER_1_ACCESS"
}
],Reproduction Steps
Running the example code in the official document
CDK stack source code:
const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', {
vpc: new ec2.Vpc(this, 'VPC'),
lifecyclePolicy: efs.LifecyclePolicy.AFTER_14_DAYS, // files are not transitioned to infrequent access (IA) storage by default
performanceMode: efs.PerformanceMode.GENERAL_PURPOSE, // default
outOfInfrequentAccessPolicy: efs.OutOfInfrequentAccessPolicy.AFTER_1_ACCESS, // files are not transitioned back from (infrequent access) IA to primary storage by default
});CloudFormation template emitted:
What did you expect to happen?
You can successfully deploy EFS even when you set both lifecyclePolicy and outOfInfrequentAccessPolicy.
What actually happened?
Deployment fails with the error message:
One or more LifecyclePolicy objects specified are malformed.
CDK CLI Version
2.13.0 (build b0b744d)
Framework Version
No response
Node.js Version
v16.13.2
OS
macOS 12.2.1
Language
Typescript
Language Version
4.5.5
Other information
No response