AWS CloudFormation Fails to Create EFS with 'InvalidSubnet' Error When Specifying Multiple Subnets
I've been banging my head against this for hours. I'm trying to create an Amazon EFS (Elastic File System) using AWS CloudFormation, but I'm running into an 'InvalidSubnet' error when I specify multiple subnets for the EFS. My goal is to have the EFS accessible in multiple availability zones for redundancy. Here's the relevant part of my CloudFormation template: ```yaml Resources: MyEFS: Type: AWS::EFS::FileSystem Properties: Encrypted: true FileSystemPolicy: Version: '2012-10-17' Statement: - Effect: Allow Principal: '*' Action: - efs:ClientMount Resource: '*' LifecyclePolicies: - TransitionToIA: AFTER_7_DAYS ProvisionedThroughputInMibps: 1 MyEFSAccessPoint: Type: AWS::EFS::AccessPoint Properties: FileSystemId: !Ref MyEFS PosixUser: Gid: '1000' Uid: '1000' RootDirectory: CreationInfo: OwnerGid: '1000' OwnerUid: '1000' Permissions: '750' Path: /exported MyEFSMountTarget1: Type: AWS::EFS::MountTarget Properties: FileSystemId: !Ref MyEFS SubnetId: !Select [0, !Ref MySubnets] SecurityGroups: - !Ref EFSecurityGroup MyEFSMountTarget2: Type: AWS::EFS::MountTarget Properties: FileSystemId: !Ref MyEFS SubnetId: !Select [1, !Ref MySubnets] SecurityGroups: - !Ref EFSecurityGroup Parameters: MySubnets: Type: List<AWS::EC2::Subnet::Id> Description: Comma-separated list of subnets for EFS mount targets. ``` I have defined a parameter `MySubnets` to accept a list of subnet IDs, but when I deploy the stack, I get the following error message: ``` InvalidSubnet: The specified subnet is not valid for EFS mount targets. Ensure that the subnet is in the same region and Availability Zone as the EFS file system. ``` I checked that the subnets I'm passing are indeed in the same VPC and region as the EFS. I've also verified that they are in different availability zones. However, I still receive this error. I've tried simplifying the template by creating only one mount target and using just one subnet, but the error persists. Is there something I'm missing about how to correctly specify the subnets for EFS mount targets? Any help would be appreciated! This is happening in both development and production on Ubuntu 20.04. Thanks for any help you can provide! The project is a web app built with Yaml. What would be the recommended way to handle this?