So have a req to filterout EFS based on Tags (Name or App code)
for EFS we cant use filter so the only way is to query so im getting the whole list by the below query but is there anyway can i query based on EFS Name like myTest* in my case, provides only EFS that matches name myTest*
aws efs describe-file-systems --query "FileSystems[*].{FileSystemID:FileSystemId, Name:Name, SizeinBytes: SizeInBytes.Value}| []|reverse(sort_by(@, &SizeinBytes))" --region="us-east-1" --output table
Tried this but no luck:
aws efs describe-file-systems --query FileSystems[?Name=='myTest*'].FileSystemId --region us-east-1 --output text
Please assist
aws efs describe-file-systems --query 'FileSystems[?Name==`$name`].FileSystemId' --region $region.
You are missing "`" with your second trial.
If you want to get the name of all the files systems you can first use the following query to find the name of the EFS
and then the previous query to get the FileSystemId
.
aws efs describe-file-systems --query 'FileSystems[*].Name' --region $region
Or you can get both FileSystemId
and the name of the EFS
with the following query.
aws efs describe-file-systems --query 'FileSystems[].[Name, FileSystemId]' --region $region