Amazon Web Services(AWS)-Terminal User Interface App-Part4

Until now, this app has the capability to work with AWS services like EC2, S3, IAM, CloudTrail, and CloudFront. In this part, I’m gonna add another AWS service that is Amazon Elastic File System(EFS).

What is EFS?

Amazon Elastic File System is a cloud storage service provided by Amazon Web Services designed to provide scalable, elastic, concurrent with some restrictions, and encrypted file storage for use with both AWS cloud services and on-premises resources.

Mainly, EFS is used to get the persistent storage for the deployments that we had created on the AWS cloud and on-premises resources.

Directory Structure of the Project:

AWS-TUI directory structure (Directories are in blue color)

The aws_run.py is the entry-point of this app.

$ python3 aws_run.py

Let’s see how this EFS service works.

How to use EFS from the AWS-TUI?

This app provides some of the EFS features like create, describe, tag, and delete the EFS file system. Also, it gives the way to create, describe, and delete the mount target.

Before starting to use the AWS-TUI lets check if we have any EFS file system already created.

As you can see, I don’t have any EFS file system already created.

Let’s start using the EFS service from the AWS-TUI.

Create an EFS file system:

To create an EFS file system we have to give the creation token, performance mode, throughput mode, the tag name. Finally, it will ask for the encryption. For encryption enter the value as True else the EFS file system will be unencrypted. The value of the creation token can be any unique value. There are two possible values for performance mode, one is the generalPurpose which is the preferred one and another is maxIO. Also, there are two possible values for the throughput mode one is bursting and another is the provisioned.

Create an EFS file system

Now, if we go to the AWS Console, we can see that the new EFS file system had created.

Describe EFS file systems:

This option is used to get the details about the file system. This option has three sub-options to describe the EFS file system.

  1. Describe EFS file system: This option will show the details of all of the EFS file systems.
  2. Describe EFS by creationToken: This option will take the creation token as input and show the details of that file system.
  3. Describe EFS by filesystem id: This option will take the EFS file system id as input and show the details of that file system.
Describe EFS file systems

Tag EFS file system:

This option is used to tag the EFS file system for management purposes. This will accept the EFS file system ID, Key, and Value from the user and tag that to the EFS file system.

Tag EFS file system

Now, if we go to the EFS file system from the AWS Console, we can see that the new tag is attached to the EFS file system.

List tags for resource:

By using this option, we can list all of the tags of the EFS file system. This option accepts only the EFS file system ID from the user and will show the tags associated with that file system.

List tags for resource

Create mount target:

After we create a file system, we can create mount targets. Then we can mount the file system on EC2 instances, containers, and Lambda functions in our virtual private cloud (VPC).

For creating the mount target, we will require the EFS file system ID and the subnet ID in which we want to create the mount target.

Create mount target

Now, by going to the AWS Console, we can see that the mount target for the EFS file system is created and that mount target is now available.

Mount target is created

Describe mount targets:

This option is used to see the details of the mount targets for the specific EFS file system. This option accepts the EFS file system ID and will show all of the mount targets created for that EFS file system.

Describe mount targets

Delete mount target:

We can delete the mount targets by simply entering the mount target ID.

Delete mount target
Mount target deleted

Delete EFS File System:

Finally, we can delete the EFS file system. This option will accept only the EFS file system ID and delete that EFS file system.

Delete EFS file system
No EFS file systems

Now, go to the AWS console and check if the EFS file system is deleted.

EFS file system deleted

Here is the link for the source code of this app:
https://github.com/cankush625/AWS-TUI

To know more about AWS-TUI refer to this blog:
https://medium.com/@ankush.chavan/amazon-web-services-aws-terminal-user-interface-app-8cacfeddb3c5

Thanks a lot for reading! If you liked this article, please applaud it. You can also follow me on Twitter at @cankush625 or find me on LinkedIn.

Tech blogger, researcher and integrator