DEV Community

DHANYA RAVI
DHANYA RAVI

Posted on

RUNNING LINUX COMMANDS AND UPLOADING THE OUTPUT TO S3 DIRECTLY THROUGH EC2 INSTANCE

Step 1: Create an ec2 instance

Give a name for the ec2 instance and select amazon machine image
Image description

Create a key value pair and the instance type should be t2.micro
Image description

Once the instance is created wait until the status turns into running state
Image description

Download putty and configure it
Image description

White listing my ip address so that only I can acccess it by editing the inbound rules
Image description

Step 2: Connecting puTTy with the ec2 instance.

Image description

Go to the puTTy gen and select the pem key that was downloaded while creating the key value pair and generate it to get the private key.

In the puTTy configuration go to the SSH category and in that select admin and in that select config and then enter the public IP address and load the private key that was saved and connect.

Image description

Run the linux commands and get the output and save it in a file .

Image description

Step 3: Create roles.

Image description

Go to the create role and in the entity type select AWS service.

Image description

In the use case select ec2 and give the role name and create the role.
Image description

The role is created.
Image description

Step 4: Now go to the ec2 instance type and select the instance and in the actions go to the security option.

Image description

In the security go to the modify iam role option.

Image description

Select the role that we created and then hit update.

Image description

Now the ec2 instance will be connected to the iam role.

Image description

Step 5: Once we enter the command [aws s3 cp filename.txt s3://bucket name/] then the file will be uploaded to the bucket.

Image description

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

Top comments (0)

Jetbrains image

Build Secure, Ship Fast

Discover best practices to secure CI/CD without slowing down your pipeline.

Read more

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay