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

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay