Create an EC2 Instance
Go to Ec2 in AWS Console
Click Instance
Launch Instance
Provide Instance name
Choose Amazon Linux
Select t2.micro as Instance type
Create a new key pair and download the pem file
Scroll to the bottom of the page and click launch instance
Now a page will show the available running instances
Select the instance
Go to security
Scroll down and there will be Inbound rules
Click on edit inbound rules and select Custom and that will show a dropdown and Select MyIP
Click on Save Changes
Now install Putty in your Laptop and open it
Follow these steps
Connection -> ssh -> Auth -> Credentiels
click on browse and paste the ppk file .
(if it is formated as pem convert it into ppk using puttygen.)
Select accept and the page will show "Login as" type "ec2-user"
Your Terminal gets opened in that just create a file and add some contents in it.
Command to create a file
cat < "file_name.txt"
To view the content in the file
cat "file_name.txt"
Now Go to AWS Console , IAM -> Roles -> Create Role
This role will have S3 full access
You can view your Roles as in the image below
Go to EC2 instance and select the instance
Actions -> security -> Modify IAM Role
Now select the created IAM role in the dropdown and update IAM role
Go to the terminal, we need to put the created file in the AWS S3 so enter the command
aws s3 cp "file_name.txt s3://"bucket_name"
If there is no bucket in the S3 then create it by using the command.
aws s3 mb s3://"bucket_name"
After creating it upload the created file in the bucket by using the command.
aws s3 cp "file_name.txt s3://"bucket_name"
After uploading the files go check your AWS console to verify
Completing every steps terminate all the services (EC2, S3, IAM role)
Top comments (0)