AWS EC2 Zip Creation
January 8, 2025 ยท AI Conversations
1. **SSH into Your EC2 Instance**: Open your terminal and connect to your EC2 instance using SSH:
ssh -i /path/to/your/key.pem ubuntu@ec2-16-170-254-93.eu-north-1.compute.amazonaws.com
2. **Navigate to the Desired Directory**: Use the `cd` command to navigate to the directory containing the files or folders you want to zip.
cd /path/to/directory
3. **Install Zip (if not already installed)**: If the `zip` command is not available, you may need to install it. For Ubuntu, you can do this by running:
sudo apt update
sudo apt install zip
4. **Create the Zip File**: Use the `zip` command to create a zip file. For example, to zip all files and folders in the current directory:
zip -r my_archive.zip *
This command creates a zip file named `my_archive.zip` that contains all files and directories in the current directory.
5. **Verify the Zip File**: You can check that the zip file was created successfully by listing the files in the directory:
ls -l
After completing these steps, you should have a zip file created on your EC2 instance. You can then download it to your local machine using `scp` if needed.
1. **SSH into Your EC2 Instance**: Open your terminal and connect to your EC2 instance using SSH:
ssh -i /path/to/your/key.pem ubuntu@ec2-16-170-254-93.eu-north-1.compute.amazonaws.com
2. **Navigate to the Directory Containing the Folder**: Use the `cd` command to navigate to the directory that contains the folder you want to zip.
cd /path/to/directory
3. **Install Zip (if not already installed)**: If the `zip` command is not available, you may need to install it. For Ubuntu, you can do this by running:
sudo apt update
sudo apt install zip
4. **Zip the Folder**: Use the `zip` command to create a zip file of the folder. For example, if you want to zip a folder named `my_folder`, you would run:
zip -r my_folder.zip my_folder
This command creates a zip file named `my_folder.zip` that contains all files and subdirectories within `my_folder`.
5. **Verify the Zip File**: You can check that the zip file was created successfully by listing the files in the directory:
ls -l
After completing these steps, you should have a zip file containing the specified folder created on your EC2 instance.