<p>I have multiple files in s3 bucket which I need to copy to one of the running Kubernetes pods under /tmp path .
Need any reliable command or try and tested way to do the same.</p>

<p>Let's say my bucket name "learning" and pod name is "test-5c7cd9c-l6qng"</p>

<p>AWS CLI commands "<a href="https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html" rel="nofollow noreferrer">aws s3api get-object</a>" or "<a href="https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html" rel="nofollow noreferrer">aws s3 cp</a>" can be used to copy the data onto the Pod from S3. To make these calls <a href="https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys" rel="nofollow noreferrer">AWS Access Keys</a> are required. These keys provide the authentication to call the S3 service. "<a href="https://docs.aws.amazon.com/cli/latest/reference/configure/index.html" rel="nofollow noreferrer">aws configure</a>" command can be used to configure the Access Keys in the Pod.</p>

<p>Coming to K8S, an <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">Init Container</a> can be used to execute the above command before the actual application container starts. Instead of having the Access Keys directly written into the Pod which is not really safe, <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">K8S Secrets feature</a> can be used to pass/inject the Access Keys to the Pods.</p>

<p>FYI ... the download can be done programmatically by using the <a href="https://aws.amazon.com/tools/" rel="nofollow noreferrer">AWS SDK</a> and the <a href="https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/S3Client.html" rel="nofollow noreferrer">S3Client</a> Interface for Java.</p>
