Search code examples
aws-cloudformationamazon-efs

How to correctly pass EFS FileSystem ID to cloudformation template?


I'm having trouble figuring out why this does not work when passing an EFS volume ID into a cloudformation template:

Parameters:
    EFSFileSystem:
        Description: EFS file system to mount
        Type: AWS::EFS::FileSystem::Id

and this doesn't work either:

Parameters:
    EFSFileSystem:
        Description: EFS file system to mount
        Type: AWS::EFS::FileSystem

I get error:

parameter type AWS::EFS::FileSystem::Id for parameter name EFSFileSystem does not exist

but this does pass the ID (fs-xxxxxxx):

Parameters:
    EFSFileSystem:
        Description: EFS file system to mount
        Type: String

Shouldn't setting the type to AWS::EFS::FileSystem::Id work?


Solution

  • There is no resource type of AWS::EFS::FileSystem::Id. Only a FileSystem resource type. If you are passing parameters into your cloudformation and you set the 'Type', you are setting the type of the parameter which can only be String, Number, List, CommaDelimitedList. Cloudformation will verify that the inputed value matches one of those Types, not a Cloudformation Resource Type.

    A Cloudformation Resource Type is a 'thing' you can create in AWS. A parameter Type is 'what' the value is that you are expecting? That's why with Type String it passes the fs-xxxxxxx value.

    http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html