DEV Community

aswin raj
aswin raj

Posted on

EC2 + S3 + IAM

Step 1: Launch a EC2 instance in your console.

Click Launch instance.
Image description

Step 2: Give a instance name to your instance.

Image description

Step 3: Select t2.micro instance type.

Image description

Step 4: Create a new key pair for your instance.

Image description

Click Launch instance.

Image description

Step 4: After creating your instance click your instance and go to the security and change your inbound rules for your instance.

Image description

Change the custom ip to my ip address.

Image description

And click save rules.

Step 5: Go to the putty app, if you are not downloaded then download it.

Image description

If your key pair is .ppm file then change it to private key with the help of puttygen.
After converting it go to the putty and enter the host ip address. And then go to the "SSH" which is in the category then click "Auth" in that click "Credentials". In that enter your private key file for authentication. And then click open.

Image description

Step 6: 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"

Image description

Step 7: Go to the AWS console and then go to the IAM->Roles. Create a role with "S3fullAccess" policy.

Image description

Step 8: Go to EC2 instance and click actions and then click security and go the modify IAM role and change the IAM role.

Image description

Step 7: 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"

Image description

After uploading the files go check your AWS console to verify it.

Image description

Completing every steps delete or terminate everything that you have created(EC2, S3, IAM).

Image description

Image description

Image description

Top comments (0)