Step 1: Create an ec2 instance
Give a name for the ec2 instance and select amazon machine image
Create a key value pair and the instance type should be t2.micro
Once the instance is created wait until the status turns into running state
Download putty and configure it
White listing my ip address so that only I can acccess it by editing the inbound rules
Step 2: Connecting puTTy with the ec2 instance.
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.
Run the linux commands and get the output and save it in a file .
Step 3: Create roles.
Go to the create role and in the entity type select AWS service.
In the use case select ec2 and give the role name and create the role.
Step 4: Now go to the ec2 instance type and select the instance and in the actions go to the security option.
In the security go to the modify iam role option.
Select the role that we created and then hit update.
Now the ec2 instance will be connected to the iam role.
Step 5: Once we enter the command [aws s3 cp filename.txt s3://bucket name/] then the file will be uploaded to the bucket.
Top comments (0)