-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ECS][Fargate]: Add EFS volumes through CloudFormation #825
Comments
Is there a timeline on this? It is disappointing to see feature releases without CFN support on day 1. We will have to jump through some hoops to make EFS work with our current setup. |
And I need it to work through the CDK. Which requires cloudformation first. |
Please note you can use custom resources while a feature is not yet supported by CloudFormation I wrote a simple proof of concept to create an ECS task definition with EFS mount through CloudFormation: |
👍 |
Any update on this one? |
I'm using a custom resource but the sad thing is that I need to replicate the whole task definition creation in stead of just amending the volume part. This issue is also blocking the inclusion into CDK. aws/aws-cdk#6918 |
Hi guys, is there an update on when the cloudformation would be updated with the EFS inclusion for ECS? |
Hi everyone, thank you for the valuable feedback. I can assure you that this is coming soon and we will provide updates here when we have more to share. We decided to release EFS for ECS (on both EC2 and Fargate) sooner so that customers can use it and provide early feedback instead of waiting till CloudFormation was ready. We understand CloudFormation is a great way to create and update resources to use new features, and we are working on improving how we release CloudFormation support for new features going forward. |
if anyone's still looking for a way to do this in CDK, here's a sample gist with a workaround, going down the path @guillaumesmo mentions above: https://gist.github.com/cajames/3daec680b1101c8358e2ff30dfadd52a The key takeaway, creating a custom resource Task Definition, and then using CDK "Raw Overrides" to attach it to the service. Documented here: https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html I've explained the method here: aws/aws-cdk#6240 (comment) Hope this can help anyone. This is a temporary workaround, and once this issue is resolved, it'll be an easier switch to remove the custom task definition and add the config directly into the service. :) |
Any update on how long it would take? A few days or weeks or months? I'm currently blocked by this issue. If it's a few days, I might just wait rather than spending a few days to figure out a workaround. |
It moved from ‘in progress’ to ‘coming soon’ which also includes issues from 2019. Not a good sign 🤔 |
Folks, it's been over 3 months since this feature was launched and there's STILL no CFN support. This will definitely make me think twice about adopting new ECS features in the future. CFN support is not a 'nice to have', it should be included on launch. |
Are we thinking about the same company? This is AWS, cfn support isn't for atleast 12-18 months after announcing clickops. |
eagerly waiting |
It's 2020. CloudFormation has been out for 9 years. How is this still happening? |
I'm eagerly looking forward to this, too and I hope we'll be kept regularly updated on progress. Just to give a bit of feedback to @srrengar , in my view there is simply no such thing as "releasing a feature" without cloudformation support. As far as I'm concerned, either it's in cloudformation where it can be documented, placed in version control and reliably, repeatedly tested and deployed or it doesn't exist. As a sole developer, I don't have time for manual features and wouldn't even consider using them. So this is me giving some feedback and a big show of encouragement to the idea of "reducing the time between a feature being released and getting cloudformation support". But I'd really like you to go all the way and understand that for many of us, a new feature is only really released when it becomes available in cloudformation. |
All these small straws triggered my move to terraform. So far so good, plus I get to skill up on a tool that can deploy to other cloud providers. |
Even worse, is, I have the same goals of documented code in version control and repeatable reliable testing, but , I need this from the AWS CDK. As CDK relies on cloudformation, I have no doubt that any CDK release of this will be well behind any eventual cloudformation update. [ I know you can mess with the cloudformation in CDK even without full support - I'd rather not do that ] |
Looks like this is supported now: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-volumes |
it works! I just hit the outdated lambda SDK issue where it rejects valid task definitions that use access points so now I can use this 🍾 |
So are you guys saying that with CDK 1.56, I can now mount EFS volumes in my task definition.... I glanced at the docs, not many good examples |
Ok. So I just looked at the docs. I'm looking at mounting an EFS volume to a Fargate task definition with the cdk It always seems to revert to Bind Mount in my TD for python volume=[ It does a synth fine, but when I checkout the TD, it creates the name, but it's still stuck at Bind Mount any ideas? Please help |
hey everyone, this is supported now. The official announcement will be published Monday |
Since it took me a few hours to glue CFN resources together to get this working, thought I'd post it here. Hopefully it saves others some time. If you run into
|
Has anyone confirmed if this works with the CDK. Everytime I synth and try to look at my CF, it only shows "Volumes": [ And yes, I did put in the efsVolumeConfiguration |
@frank69m While I don't think this feature has been added to the CDK generated CFN resources or higher level constructs yet, I was able to use this feature through the CDK escape hatch: https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html To my Fargate task definition I added a property override: const cfnTask = this.task.node.defaultChild as CfnTaskDefinition;
cfnTask.addPropertyOverride('Volumes', [{
EFSVolumeConfiguration: {
FilesystemId: this.fileSystem.fileSystemId,
TransitEncryption: 'ENABLED'
},
Name: 'efs'
}]); and to the container added to that task definition I added a mount point: container.addMountPoints({
sourceVolume: 'efs',
containerPath: '/data',
readOnly: false
}); I have successfully used this to add an EFS mount to a Fargate task. |
I still have only the "docker_volume_configuration" option with CDK 1.56.0 and python. I use the ecs.FargateTaskDefinition.add_volume function: Task Definition
Someone else test it with cdk+python? |
Here is the official announcement - https://aws.amazon.com/about-aws/whats-new/2020/08/amazon-ecs-announces-cloudformation-support-for-amazon-efs-volumes/ |
great. works now with CDK and the @engineal solution above. |
Just to close the gap for anyone looking for a python solution based on @engineal 's submission, here's what I implemented in CDK:
|
For anyone still having issues with this, I seems ensuring that you explicitly set the platform version in your containers definition to '1.4.0' solves the problem. When using 'latest' this is actually implying 1.3.0 which seems does not support the latest announcements. |
Yes @skindc , yes this has been solved in version 1.4.0 in August this year. |
@skindc / @yogeshjoshi tangential to this thread, we have an open issue around how to better manage/communicate new Platform Versions. If you have opinions or feedback please leave a comment at #1069 . Thanks! |
@engineal I'm using your solution above, but when using
Do you know if it's still possible to attach an EFS volume to a container that has been created with:
|
Hi @eob and anyone else who is interested. I believe the property override I had suggested before isn't required anymore, as these props are now supported by the aws-cdk constructs. I can replace my previous use of the property override with a call to the this.task.addVolume({
name: "efs",
efsVolumeConfiguration: {
fileSystemId: this.fileSystem.fileSystemId,
transitEncryption: "ENABLED"
}
}); And just like before, to the container added to that task definition I added a mount point referencing that volume: container.addMountPoints({
sourceVolume: 'efs',
containerPath: '/data',
readOnly: false
}); Now for your example @eob, if you've created your service using the ecs-patterns const service = new ApplicationLoadBalancedFargateService(this, 'service', {
taskImageOptions: {
image: ContainerImage.fromEcrRepository(...),
environment: { ... },
containerPort: 8080,
enableLogging: true,
}
}); you can access the task definition created by that service using service.taskDefinition.addVolume({
name: "efs",
efsVolumeConfiguration: {
fileSystemId: this.fileSystem.fileSystemId,
transitEncryption: "ENABLED"
}
}); Now the So, to add the mount point to the container created by the service.taskDefinition.findContainer('web')?.addMountPoints({
sourceVolume: 'efs',
containerPath: '/data',
readOnly: false
}); or service.taskDefinition.defaultContainer?.addMountPoints({
sourceVolume: 'efs',
containerPath: '/data',
readOnly: false
}); |
@engineal thank you for so kindly explaining that! Your comment got everything deploying properly, but I'm still getting permissions errors when I try to actually access the volume. I've seen a few articles about configuring AccessPoints with EFS, but most Fargate tutorials proceed without them as if they're not actually necessary. Do you know if there any permissions gotchas that I might not be noticing? This is what my code looks like -- I copy-paste-customized the ApplicationLoadBalancedFargateService code so that it's easier to just pass in mounts as an option.
|
@eob Would you happen to be able to describe or include in a comment the error message that you receive? |
@eob What is the user (UID/GID) of the user running within the container? You might have to create an access point for specific Posix user to get around Posix permissions. https://docs.aws.amazon.com/efs/latest/ug/accessing-fs-nfs-permissions.html |
Just adding to what @eob and @sukrit007 said, if you want to use an access point in your Fargate service so that you can mount as non-root here is what I did (assume 2000 is the POSIX UID that runs inside the container):
|
Community Note
Tell us about your request
CloudFormation support for adding EFS volumes to ECS tasks on Fargate or EC2.
Which service(s) is this request for?
Fargate, ECS
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
EFS support launched for ECS on Fargate and EC2. Customers deploying through CloudFormation should also be able to use this feature.
The text was updated successfully, but these errors were encountered: