Description: Here I have explained how to sync EC2 instance with S3 bucket
Create an IAM User: First I am creating IAM user for authentication and authorization
- To create user IAM user Open AWS console https://console.aws.amazon.com/iam/
- Select the option "Attach existing policy" and search for "AdministratorAccess" and "AmazonEC2FullAccess"
- Review policy and click on Create User
- Download .csv file and save in the local path
- Create EC2 instance and log on to the machine once the instance is up
- Run aws configure command to configure user details where it will ask AccessKey and SecretKey. It will ask some information from CSV file which download under Create IAM user as follow
- Now I am installing HTTP on server using below command
- Create default.php file in /var/www/html
Create S3 Bucket
- To create S3 Bucket open Amazon S3 console and choose "Create Bucket"
- In "Create a Bucket" type a bucket name in the Bucket Name field
- Create an empty bucket and looks like as follow
- To sync EC2 content to S3 bucket access ssh console and run below command
# aws s3 sync /var/www/html/ s3://testsynch/datasync
Description of the above command
aws s3 sync - To sync
/var/www/html/ - Path where our actual php file is placed in EC2
s3://testsynch/datasync - Path where to Sync in S3 bucket
Amazing..great read and very much helpful
ReplyDelete