Monday 11 March 2019
How to Create Presigned URL for S3 by Raj Gupta
Create a
role in which give EC2 full access to S3 then assign that role to EC2 during
creation of EC2
[root@ip-172-31-82-249
~]# sudo pip install --upgrade awscli ---this command is used to install awscli
[root@ip-172-31-82-249
~]# aws s3 ls –this command is used to check all bucket
[root@ip-172-31-82-249
~]# aws s3 mb s3://raj1987 -- this
command is used to create a bucket
[root@ip-172-31-82-249
~]# echo "Raj" > raj.txt
--this command is used to create a file and in this file copy the output
of echo command
[root@ip-172-31-82-249
~]# aws s3 cp raj.txt s3://raj1987 –this command to copy file from ec2 to s3
[root@ip-172-31-82-249
~]# aws s3 ls s3://raj1987 --this
command to check file copy or not
[root@ip-172-31-82-249
~]# aws s3 presign s3://raj1987/raj.txt --expires-in 300
This
command will give below presign URL to access private object for 300s
https://raj1987.s3.amazonaws.com/raj.txt?AWSAccessKeyId=ASIAWSYHFCM35HQSWCTB&Exp
ires=1551863679&x-amz-security-token=FQoGZXIvYXdzEHIaDAN4uVeuOZupqTsfkyK3Aw3myN3 8nhQGgiH4ooe8NGR7ro0ehNE6ciF5nljp2OBDD7TLDRO08yVdKflNUwYVQadWTVSjHb%2BKWpvLJFHLn
IGXeWAsiq2xGmCh%2Fhw%2FO2e8IaTOP6w8%2BShhk6IM2em69YEYzAR8nAWA5%2BntOaSWFnwgzocjw
VKOOPUGxVtFVRMWqN2nMJ9vD78fgFEy5Tb5jnHJSNqvr8HkRGdLRLbbi2UFFrdE23DlSJIcWecbEmVJr ClYn02b1SQ%2FNISqRU4W0F%2BAzF3wzGrIExRLaUgDbaP4ui%2FDOSE3Wxti9JlE2Zmjja8Nt07ezHt
deAHFNiA13WidzMnv1zjx5RyBXqoEUKm86Kq9CYmYkiYPO1D%2B%2BldZ1ek18J0ucZwj%2Bm9NCJ5x4
FtDzIE96D8Fg6kBJE%2FFCCejrrrR9euEZMPreipDTK%2B6c4WN6zC8Loaek0RRbBrB6cOmtqRS95VYs hlmYVGGvCHGd8SNG7NTbAuZTp%2FILiq%2BO1MLOOsPfJJGNC88tXcKYKHTG%2BhKj%2FmA6ec5y5jZv
C5yp6o2b2mLbcz2N27ArPJ3hgiqsAhn%2FQHsZLsRlecbyXuRs5rgP%2Fkov5j%2B4wU%3D&Signatur
e=L1oQoh%2Bs5OjCBfegEEU5fn48i8g%3D
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment