Skip to content

Help related EC2

0

Hello,

I am new to AWS and my I have created my account in free AWS tier. I need some help related AWS EC2:- 1] How to add PHP website in ec2. 2] How to connect domain with ec2. 3] In what region I will not get paid in ec2?

Regards, Abhijeet

2 Answers
1
Accepted Answer

Uploading your PHP website to EC2

a. Alright, first things first. You need an EC2 instance. Hop over to your AWS Management Console, select the EC2 Dashboard, and hit that 'Launch Instance' button.

b. You're going to need an Amazon Machine Image (AMI). As you're going to host a PHP website, go ahead and pick an AMI with a LAMP (that's Linux, Apache, MySQL, PHP) stack. You can find a few of these in the AWS Marketplace.

c. Choose an instance type next. If you're just testing things out, the 't2.micro' instance should be more than enough.

d. Tweak your instance details, storage, and tags to fit your needs.

e. Set up your security group. Remember to swing open port 80 for HTTP traffic and port 22 for SSH.

f. Done? Great! Hit 'Launch'. You'll be asked to create a new key pair or use an existing one. This is crucial for connecting to your instance.

g. Once your instance is up and running, use SSH to connect to it. You'll need that handy .pem file from the key pair you created earlier.

h. To get your PHP website onto EC2, you need to transfer your files to the server. SFTP (Secure File Transfer Protocol) is your friend here. All you need is your .pem file and your instance's public DNS.

i. Once connected, head over to the /var/www/html directory. This is Apache's home base, where you'll be dropping your website files.

j. Pop your PHP files into this directory. If you have an index.php file, it should auto-load when you point your browser to your instance's public IP or DNS.

Linking your domain with EC2

a. Next up, you'll need to create a record set in AWS Route 53. This will need you to move your domain's DNS service to Route 53 if you haven't done that already.

b. Once in Route 53, create a 'Hosted Zone' for your domain.

c. In your hosted zone, create a new record set. You can leave the name blank to direct the domain itself to your instance (like example.com), or you can specify a subdomain (like www.example.com).

d. Select the 'A - IPv4 address' type, and drop your EC2 instance's public IP in the value field.

e. Save the record set and grab a cup of coffee. It can take up to 48 hours for your domain to point to your EC2 instance, but usually, it's much quicker.

Avoiding charges with EC2

AWS's Free Tier gives you 750 hours of EC2 running time every month, regardless of where you are. That's just enough to keep a t2.micro instance (or t3.micro for newer accounts) running non-stop for a month. If you exceed these limits, AWS will start charging based on the rates for your chosen region and instance type.

Keep in mind, additional services and resources (like EBS volumes, or data transfers beyond 15GB) have separate charges and aren't necessarily covered in the Free Tier. Be sure to check the Free Tier terms and specific pricing for any services you use to avoid surprises.

Hope this helps! If you have more questions, feel free to ask. Happy cloud computing!

answered 3 years ago
  • Thank you for the reply Ercan!!

    I have created EC2 by following your instruction but I am stuck at one point now..

    May I know how to connect instance with SSH when I click connect to instance and head over to SSH Client it's showing that open SSH client.. May I know how to open it??

    Do i need to create any database for my website?

    Regards, Abhijeet

1

You might consider reviewing the tutorials in the EC2 User Guide at this link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-tutorials.html

AWS
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.