1. Introduction to AWS EC2 and S3 Integration
AWS (Amazon Web Services) offers a wide range of cloud solutions, with EC2 being a popular service for scalable computing capacity. This guide walks you through launching an EC2 instance, connecting it via SSH using PuTTY, integrating with an S3 bucket, and cleaning up resources.
2. Creating an EC2 Instance
Step 2.1: Choose Amazon Linux as the AMI
- Log in to your AWS Management Console.
- Navigate to the EC2 Dashboard and click Launch Instance.
- Select Amazon Linux as your Amazon Machine Image (AMI).
Step 2.2: Choose Instance Type
- Select t2.micro (Free Tier eligible) as the instance type.
Step 2.3: Key Pair Creation
- Create a new key pair or use an existing one.
- Download the .pem file and store it securely (you’ll need it to connect via SSH).
Step 2.4: Configure Security Group
- Set up inbound rules to allow SSH (port 22) access.
- Review and launch your instance.
3. Connecting to the Instance with PuTTY
Step 3.1: Install PuTTY
- Download PuTTY and PuTTYgen from the official website.
- Install and extract PuTTY on your system.
Step 3.2: Edit Security Group Inbound Rules
- Ensure that the SSH port is open to your local machine’s IP.
Step 3.3: Convert Key Pair Using PuTTYgen
- Use PuTTYgen to convert the .pem file to a .ppk file for use with PuTTY.
Step 3.4: Connect Using PuTTY
- Open PuTTY and enter the Public IPv4 address of your EC2 instance in the Host Name field.
- Navigate to Connection > SSH > Auth and upload the .ppk file.
- Click Open to connect to your EC2 instance as the ec2-user.
4. Assigning an IAM Role for S3 Bucket Access
Step 4.1: Create an IAM Role
- Go to the IAM Dashboard and create a new role.
- Assign the AmazonS3FullAccess policy to the role.
Step 4.2: Attach the Role to the EC2 Instance
- Navigate to the EC2 Dashboard, select your instance, and choose Actions > Security > Modify IAM Role.
- Attach the newly created role to the instance.
5. Uploading Files to S3 via EC2 Terminal
Step 5.1: Create an S3 Bucket
- Navigate to the S3 Dashboard and create a new bucket.
Step 5.2: Upload a File
- SSH into your EC2 instance.
-
Use the AWS CLI to upload a file to the S3 bucket:
- aws s3 cp <local-file-path> s3://<your-bucket-name>/
6. Cleaning Up Resources
Step 6.1: Terminate the EC2 Instance
- Go to the EC2 Dashboard and terminate the instance.
Step 6.2: Delete the IAM Role
- Navigate to the IAM Dashboard and delete the role.
Step 6.3: Remove S3 Bucket (Optional)
- Delete the S3 bucket if you no longer need it.
Top comments (0)