#!/bin/bash source ../../../eks.conf # FSX Configuration # All settings are required ## IAM Policy to provide access to FSx, if configured policy name does not exist, it will be created. export FSX_POLICY_NAME=fsx-csi export FSX_POLICY_DOC=file://fsx-policy.json ## Derive asg1_name=$(eksctl get nodegroups --cluster $CLUSTER_NAME | grep -v NAME | head -n 1 | awk '{print $10}') launch_template_name=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name=$asg1_name | jq -r .AutoScalingGroups[].MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification.LaunchTemplateName) instance_profile_name=$(aws ec2 describe-launch-template-versions --versions '$Default' --launch-template-name=$launch_template_name | jq -r .LaunchTemplateVersions[].LaunchTemplateData.IamInstanceProfile.Name) instance1_id=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name=$asg1_name | jq -r .AutoScalingGroups[].Instances[0].InstanceId) subnet_id=$(aws ec2 describe-instances --instance-id=$instance1_id | jq -r .Reservations[0].Instances[0].SubnetId) ## Instance profiles of EKS node groups that will have access to FSx. Space separated string enclosed in (). export EKS_INSTANCE_PROFILE_NAMES=($instance_profile_name) ## Subnet to use for all EKS nodes and FSx volumes export FSX_SUBNET_ID=$subnet_id ## Security group name for access to FSx volumes. Will be created if it does not exist. export FSX_SECURITY_GROUP_NAME=eks-fsx-sg ## Name of FSX storage class to create or update export FSX_STORAGE_CLASS_NAME=fsx-sc