This is one of the things the new `diskutil image` subcommand mentioned in the article supports: `diskutil image attach ram://${size}m`.