aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
447 stars 198 forks source link

Export EKS components stacks in order to use cross-stacks #393

Closed vumdao closed 2 years ago

vumdao commented 2 years ago

Describe the feature

I would like to create EFS with networking in the EKS VPC and want to import the VPC stack from EKS stack CfnOutput

Use Case

Cross-stacks between EKS blueprints and AWS resources which want to attach EKS VPC, EKS SG and maybe roles

Proposed Solution

No response

Other Information

No response

Acknowledgements

CDK version used

2.20.0

EKS Blueprints Version

2.20.0

Node.js Version

v16.13.0

Environment details (OS name and version, etc.)

Ubuntu

shapirov103 commented 2 years ago

For cross stack resources, have you tried leveraging the DirectVpcProvider? Documentation of resource providers is available here.

E.g.:

blueprints.EksBlueprint.builder()
    //  Specify VPC for the cluster (if not set, a new VPC will be provisioned as per EKS Best Practices)
    .resourceProvider(GlobalResources.VPC, new blueprints.DirectVpcProvider(myVpc)
vumdao commented 2 years ago

Thanks @shapirov103 I actually want to use the stacks which EksBlueprint creates such EKS VPC, SG. I can find the solution now

const cluster = eksCluster.getClusterInfo().cluster;
const eksVPC = cluster.vpc;
const eksSG = cluster.clusterSecurityGroup;