{"id":7507,"date":"2018-06-01T22:47:03","date_gmt":"2018-06-01T14:47:03","guid":{"rendered":"http:\/\/rmohan.com\/?p=7507"},"modified":"2018-06-01T22:47:03","modified_gmt":"2018-06-01T14:47:03","slug":"s3-aws-instance","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7507","title":{"rendered":"s3 aws instance"},"content":{"rendered":"<p>creating a bucket:<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\nS3 &gt; Create bucket &gt; unique name + region &gt; create<br \/>\nbucket &gt; select &gt; upload &gt; upload file or drag n drop<\/p>\n<p>Backup Files to Amazon S3 using the AWS CLI<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\nStep 1: create login for aws console:<br \/>\nIAM &gt; Users &gt; Create &gt; username: AWS_Admin &gt; Permissions &gt; Attach policy &gt; AdministratorFullAccess<br \/>\n&gt; Manage password &gt; Auto generated, uncheck require password change &gt; apply<br \/>\n&gt; Download credentials &gt; credentials.csv<\/p>\n<p>Step 2: install and configure aws cli<br \/>\ndownload AWSCLI64.msi &gt; install &gt; windows run &gt; cmd<\/p>\n<p>Type aws configure and press enter. Enter the following when prompted:<\/p>\n<p>AWS Access Key ID [None]: enter the Access Key Id from the credentials.csv file you downloaded in step 1 part d<\/p>\n<p>Note: this should look something like AKIAPWINCOKAO3U4FWTN<br \/>\nAWS Secret Access Key [None]: enter the Secret Access Key from the credentials.csv file you downloaded in step 1 part d<\/p>\n<p>Note: this should look something like 5dqQFBaGuPNf5z7NhFrgou4V5JJNaWPy1XFzBfX3<\/p>\n<p>Default region name [None]: enter us-east-1<br \/>\nDefault output format [None]: enter json<\/p>\n<p>Step 3: Using the AWS CLI with Amazon S3<br \/>\na. Creating a bucket is optional if you already have a bucket created that you want to use.<br \/>\nTo create a new bucket named my-first-backup-bucket type aws s3 mb s3:\/\/my-first-backup-bucket<\/p>\n<p>Note: bucket naming has some restrictions; one of those restrictions is that bucket names must be globally unique (e.g. two different AWS users can not have the same bucket name);<br \/>\nbecause of this, if you try the command above you will get a BucketAlreadyExists error.<\/p>\n<p>b. To upload the file my-first-backup.bak located in the local directory to the S3 bucket my-first-backup-bucket,<br \/>\nyou would use the following command:<br \/>\naws s3 cp my-first-backup.bak s3:\/\/my-first-backup-bucket\/<\/p>\n<p>c. To download my-first-backup.bak from S3 to the local directory we would reverse the order of the commands as follows:<br \/>\naws s3 cp s3:\/\/my-first-backup-bucket\/my-first-backup.bak .\/<\/p>\n<p>d. To delete my-first-backup.bak from your my-first-backup-bucket bucket, use the following command:<br \/>\naws s3 rm s3:\/\/my-first-backup-bucket\/my-first-backup.bak<\/p>\n<p>additional commands<br \/>\nrecursively copying local files to s3<br \/>\naws s3 cp myDir s3:\/\/mybucket\/ &#8211;recursive &#8211;exclude &#8220;*.jpg&#8221;<\/p>\n<p>recursively remove files (with caution!)<br \/>\naws s3 rm myDir s3:\/\/mybucket\/ &#8211;recursive &#8211;exclude &#8220;*.jpg&#8221;<\/p>\n<p>list files:<br \/>\naws s3 ls s3:\/\/mybucket<\/p>\n<p>remove bucket:<br \/>\n$ aws s3 rb s3:\/\/bucket-name<br \/>\nor<br \/>\n$ aws s3 rb s3:\/\/bucket-name &#8211;force<\/p>\n","protected":false},"excerpt":{"rendered":"<p>creating a bucket: &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- S3 &gt; Create bucket &gt; unique name + region &gt; create bucket &gt; select &gt; upload &gt; upload file or drag n drop<\/p>\n<p>Backup Files to Amazon S3 using the AWS CLI &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Step 1: create login for aws console: IAM &gt; Users &gt; Create &gt; username: AWS_Admin &gt; Permissions &gt; [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7507"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7507"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7507\/revisions"}],"predecessor-version":[{"id":7508,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7507\/revisions\/7508"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}