r/aws • u/aws-dojo • Aug 07 '20
serverless AWS Lambda now supports EFS. Practice hands-on with this exercise.
http://aws-dojo.com/excercises/excercise7[removed] — view removed post
21
u/mjs2020 Aug 07 '20
When AWS announced this I got excited and wanted to use it at work and got burned because I did not realise until after doing a fair amount of work that having the lambda run inside the VPC (in order to mount the EFS fs) meant losing access to other AWS endpoints such as SNS, SQS, Cloudwatch which I needed for that lambda. There are options to get access to these (NAT and interface enponts) but can add significant cost and effort if you don't already use them. This is a good overview https://www.alexdebrie.com/posts/aws-lambda-vpc/
Might have been obvious to others but I missed it so thought I'd share to prevent anyone else coming late to that realisation.
17
u/Some_IT_dude Aug 07 '20
The endpoints you mentioned are available as VPC endpoints so that solves that problem very quickly.
5
Aug 07 '20
[removed] — view removed comment
6
5
u/jonathantn Aug 07 '20
The TCO in my mind is
Cost/Hr + Cost/GB = VPC Endpoint
Cost/GB = NATAssuming the hourly cost of NAT is a sunk cost and it's in the VPC already. So the break even point for a VPC endpoint on bandwidth is 206 GB of data through the endpoint vs the NAT gateway.
S3 and DynamoDB gateways are free and everyone should always use those. VPC endpoints once the traffic is at that level.
2
u/Some_IT_dude Aug 07 '20
They're like a penny an hour.
3
u/houz Aug 08 '20
Per endpoint, per AZ. It can add up, depending on how your environment is structured.
5
u/shotgunsparkle Aug 07 '20
You can segregate the lambdas that has access to EFS and your other things and orchestrate it using stepfunctions. Add vpc to the lambda that uses EFS and do whatever on the rest
-2
u/chaospatterns Aug 07 '20 edited Aug 08 '20
That sounds like you're adding more architectural complexity to workaround limitations in AWS and you'd be better suited to just use a solution where you can have it in a single component, for example a AWS Fargate scheduled task. This would give the same benefits of Lambda where you don't manage OS patching.
Serverless should reduce cognitive complexity not add to it.
2
u/--algo Aug 07 '20
Significant cost im not so sure of. It's $35 / month
5
u/mjs2020 Aug 07 '20
We're a small org and running stuff in 5 or 6 regions. Our preference would have been interface endpoints but they are $22/service/region/month. With two services we needed access to it would have meant more that $200/month on our bill for using those services, for us it's significant. NAT would have been cheaper but we handn't really anticipated messing with our VPC when we got excited about using EFS+Lambda so we thought we were going for a quick win. We (and by we I really mean I) misjudged and that's on us.
11
Aug 07 '20
Not sure if you know this or not but you can make a NAT EC2 instance and use its network interface in the place of a NAT gateway which is significantly cheaper and still offers up to 1gbps local transfer speed.
So you could have private subnets and then bridge them to your public subnet via route tables.
We are a smallish agency and use this with great success and rely on EFS extensively for internal block storage.
2
1
0
Aug 07 '20
[deleted]
3
u/stephanemaarek Aug 07 '20
You can’t. The doc mentions that. Unfortunate limitation
0
Aug 07 '20
[deleted]
1
u/stephanemaarek Aug 07 '20
1
u/doublefelix7 Aug 08 '20
Off-topic, but just wanted to say that I enjoy your AWS exam prep courses on Udemy.
1
u/indianapwns2 Aug 07 '20
the Lambda function in the example isn't trying to access anything outside the VPC, so in this example it doesn't matter.
2
u/indianapwns2 Aug 07 '20
AWS Lambda functions running in a VPC do not get public IPs assigned to them, even if you try running them in a public subnet, so this is not an option. You have to use a NAT to give them access to things outside the VPC.
1
2
u/serendipity7777 Aug 07 '20
Anyone has a benchmark of speed comparing this to EC2, or to an actual mounted hard drive ?
2
u/M1keSkydive Aug 07 '20
Significantly slower especially for accessing multiple files (eg listing directories or running a PHP website)
2
u/omeganon Aug 07 '20
I don't have benchmarks, but anecdotally, one of the Eng teams that I work with has an open support case related to this. They're trying to move some workloads that require high performance access to EFS from EC2 to Lambda (it's highly parallelize-able work). The word from them is EFS is significantly slower from Lambda than EC2.
1
u/serendipity7777 Aug 07 '20
Thanks, so It's not mature yet for i/o intensive workloads like geocoding
-6
u/ydio Aug 07 '20
"now supports"? This has been out since June 16th.
2
6
Aug 07 '20
So it's true. It does support this right now.
Back off - the guy put together a tutorial to help folks out.
0
u/ydio Aug 07 '20
The lack of HTTPS and "kindly use the link to create free trial" should have been a dead giveaway that this would be low quality content.
-2
Aug 07 '20
Why do you need https on a blog?
And the public link with no affiliate code attached to it?
Try harder. The guy is doing a good thing.
1
u/ydio Aug 07 '20
Why do you need https on a blog?
Because my ISP doesn't need to know which article I'm reading on that site
Because a MITM could inject malware
Because it's 2020 and certificates are free
Because every modern browser labels the website as "Not Secure" in the address bar
-1
Aug 07 '20
So for you, not for him. Got it.
Don’t want to read his content because it doesn’t meet your standards? Move on.
0
u/ydio Aug 07 '20
So for you, not for him. Got it.
Perhaps you don't understand the affects of your domain being associated with malware because you refuse to properly secure it. It very much affects the website operator. Additionally, showing your visitors "Not Secure" doesn't do your website and its reputation any good. Lastly, Google penalizes websites that don't use HTTPS (which would be something that 100% affects the website, not me).
Try harder.
0
Aug 07 '20
It’s a blog. He posted a link. I have no problem with it. Sorry you do.
Thanks, OP, for good content.
5
u/admiralsj Aug 07 '20
Interesting but in what situation would you use EFS over S3?