AWS-Notes home resume

Accessing ec2 instance metadata (on linux) - can access from within instance using command line
[root@ip-xxx-xx-24-0 ~]# curl http://169.254.169.254/latest/meta-data/

Output to file : [root@ip-xxx-xx-24-0 ~]# curl http://169.254.169.254/latest/meta-data/ > metaData.txt

Read file and output each option:

#!/bin/bash

METASTR='curl http://169.254.169.254/latest/meta-data/'
echo $METASTR
while read line
do
cmdline="$METASTR$line"
echo "$cmdline"
$cmdline
printf "\n"
done < /root/metaData.txt


S3 cross region replication


lab - create new bucket for cross region replication
now replicate from other bucket to this new bucket
NOTE: items are NOT automatically replicated
how then, to move what in 1 bucket to another? must use command line
must install cmd line tools
aws cli tools bundler - search online using search tool to find "asw cli tools bundler"
Get the link to "linux"

It will be these commands on linux (did this using rasp pi4):
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
linux# aws configure 
AWS Access Key ID [***************k]:     (this is basically username and ...) 
AWS Secret Access Key [None]: (password)
# aws iam list-users
go to aws console to generate these
Will need to go to IAM and create a group and user in that group
once created you can see (copy and paste to cmd line - access key and pwd (secret access key) -
then type:
linux# aws s3 ls
and it should list out the bucket contents

Now to copy to the other region /other bucket
linux# aws s3 cp --recursive s3://versioningbuck.tlI s3://isano.replicatebuckt.ireland
- version must be enabled on both source and destination buckets.
- regions must be unique
- files in existing bucket are not replicated automatically, but all subsequent updated files will be replicated automatically
- must use command line, as noted above to replicate initially.
- cannot replicate to multiple buckets or use daisy chaining (at this time).
- delete markers are not replicated
- deleting individual versions or delete markers will not be replicated
( acloud guru)


home resume