skip to Main Content

I have few files in an ec2 machine of Account A. I would like to copy these files to a s3 bucket in Account B with User A. Could you please guide me with the necessary IAM policy or the list of procedures to be followed to achieve this?

2

Answers


    1. Create an IAM policy in account A with Full S3 access and generate the programmatic access keys
    2. SSH to ec2 in account B, and install AWS-CLI
    3. Create a credentials file ~/.aws/credentials
    [accounta]
    aws_access_key_id = YOUR_ACCESS_KEY_HERE
    aws_secret_access_key = YOUR_SECRET_KEY_HERE
    
    1. Create a config file ~/.aws/config
    [accounta]
    region = xx-xxxxx-n
    output = table
    
    1. Run the following command to copy all the files to S3 bucket
      aws --profile accounta s3 sync ./source/ s3://target-bucket/
    Login or Signup to reply.
  1. 1.Check if you have IAM roles or policies which will allow the required process if not set up required rules to allow cross-account access.

    2.check if the AWS CLI is installed on EC2 instance, if not install it.

    3.then configure the AWS CLI with the help of "aws configure"

    4.after configuring you can use command "aws s3 cp /path/to/local/file s3:///path/to/s3/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search