Skip to main content

How to Download AWS S3 Content Using AWS CLI on a Mac Machine

Here's a step-by-step guide to setting up and using the AWS CLI to download files from S3.

1) Install AWS CLI on Your Mac

To start, ensure that you have Homebrew installed on your Mac. Homebrew is a package manager that simplifies the installation of software. If you don't have Homebrew installed, you can do so by running this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once Homebrew is installed, follow these steps:

Update Homebrew to make sure you have the latest packages:

% brew update

Install AWS CLI using Homebrew:

% brew install awscli

After installation, verify that AWS CLI is correctly installed by checking its version:

aws --version

This command should return the version of AWS CLI installed on your system.

2) Configure AWS CLI with Your Credentials

To interact with AWS services, you'll need to configure your AWS CLI with your access keys (Access Key ID and Secret Access Key). Follow these steps to generate your access keys:

2.1) Log in to the AWS Console.

2.2) Click on your username (top-right corner) and select Security Credentials from the dropdown menu.

2.3) In the Access Keys section, click Create New Access Key to generate an Access Key ID and Secret Access Key. Save these keys securely.


Next, configure AWS CLI with these credentials:

Open or create the credentials file at ~/.aws/credentials. You can do this by running the following command:

nano ~/.aws/credentials

Add your Access Key ID and Secret Access Key under the [default] profile:

[default]
aws_access_key_id=<your_access_key_id>
aws_secret_access_key=<your_secret_access_key>

Replace <your_access_key_id> and <your_secret_access_key> with your actual keys.

Save and close the file.

3) Download Content from AWS S3 to Your Mac

Now that your AWS CLI is configured, you can use it to download files from an S3 bucket. The following command allows you to copy files from an S3 bucket to your local machine.

Use the aws s3 cp command with the --recursive flag to download all contents from a specific bucket:

aws s3 cp s3://<bucket-name>/ ~/Desktop --recursive

Replace <bucket-name> with the name of your S3 bucket.

~/Desktop is the destination folder on your local machine where the content will be downloaded.

This command will recursively download all objects from the specified S3 bucket to your desktop.


Comments

Popular posts from this blog

Deploying Spring Boot microservices on Kubernetes Cluster

This article guides you through the deployment of two Spring Boot microservices, namely "order-service" and "inventory-service," on Kubernetes using "MiniKube" . We will establish communication between them, with "order-service" making calls to an endpoint in "inventory-service." Additionally, we will configure "order-service" to be accessible from the local machine's browser . 1) Create Spring Boot microservices The Spring Boot microservices, "order-service" and "inventory-service," have been developed and can be found in this GitHub repository. If you are interested in learning more about creating Spring Boot REST microservices, please refer to this or this (Reactive) link. 2) Build Docker Images The Docker images for both "order-service" and "inventory-service" have already been generated and deployed on DockerHub, as shown below. codeburps/order-service cod...

Circuit Breaker Pattern with Resilience4J in a Spring Boot Application

Read Also: Spring Cloud Circuit Breaker + Resilience4j Resilience4j is a lightweight fault tolerance library that draws inspiration from Netflix Hystrix but is specifically crafted for functional programming. The library offers higher-order functions, known as decorators , designed to augment any functional interface, lambda expression, or method reference with features such as Circuit Breaker, Rate Limiter, Retry, or Bulkhead . These functionalities can be seamlessly integrated within a project, class, or even applied to a single method. It's possible to layer multiple decorators on any functional interface, lambda expression, or method reference, allowing for versatile and customizable fault tolerance. While numerous annotation-based implementations exist online, this article focuses solely on the reactive approach using router predicates and router functions . How Circuit Breaker Pattern works? In general, a circuit breaker functions as an automatic electrical s...

How to create a basic Spring 6 project using Maven

Below is a step-by-step guide to creating a basic Spring project using Maven. 1) Create a Maven Project Use the following Maven command to create a new Maven project. mvn archetype:generate -DgroupId=com.tb -DartifactId=spring-demo -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 2) Import in IntelliJ IDEA If you haven't already, open IntelliJ IDEA on your system. Go to "File" > "New" > "Project from Existing Sources..." . In the file dialog, navigate to the directory where your Maven project is located. Select the pom.xml file within the project directory and click "Open." 3) Update pom.xml In total, the application requires the below-mentioned dependencies: 4) Create Spring Configuration Create a Java configuration class that uses annotations to define your Spring beans and their dependencies. This class should be annotated with @Configuration . 5) Create the Main Application C...