Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

copy files from s3 to ec2 vice versa

# To Install AWS CLI
sudo apt install awscli

# To Set/Configure Access and S3 Bucket Region
aws configure
Enter AWS Access Key ID:
Enter AWS Secret Access Key:
Enter Default region name: ap-southeast-1
Default output format: json

# To List the S3 Bucket 
aws s3 ls s3://<bucket name>

ex. aws s3 ls s3://source-folder

# To copy the files from EC2 to S3
aws s3 cp <filename> s3://<bucket name> 

ex. aws s3 cp file.tar.gz s3://source-folder

# To copy the files from S3 to EC2
aws s3 cp s3://<S3BucketName> <Local filename/Directory>

ex. aws s3 cp s3://source-folder/file.zip /home/ubuntu
Source by www.middlewareinventory.com #
 
PREVIOUS NEXT
Tagged: #copy #files #vice #versa
ADD COMMENT
Topic
Name
2+2 =