Açıklaması şöyle. Yani donanım sağlar gibi düşünülebilir.
Amazon Elastic Compute Cloud (EC2) lets you easily provision and scale infrastructure resources, on-demand. The main resource EC2 provides is called an EC2 instance, which is essentially a virtual server provisioned in the AWS cloud. There is a wide range of EC2 instance types, each providing different CPU, storage, network capacity, and memory.EC2 integrates natively with AWS monitoring tools, as well as with Elastic Load Balancing and Auto Scaling, which help you optimize usage and costs.
Açıklaması şöyle
The core of the web of AWS is EC2. You can think of this as a service that provides servers where your applications will be running.
EC2 Instance Çeşitleri yazısına bakabilirsiniz
Soldaki bazı menüler şöyle
Events — It may include planned activities that are being carried out by AWS in a particular region.Tags — You assign tags to your resources in AWS to easily filter and manage them. In EC2 you can assign tags to your instances, EBS volumes, Elastic Load Balancers, Snapshots, AMIs, etc. You can see all those tags here.Reports — Here you can see your cost and usage reports for your EC2 usage. You can use these reports to analyze and optimize your resource usage.Limits — This shows you your EC2 resource limits like Instance Limits (Number of instances you can launch), EBS Limits (Amount of storage in TiB you can provision), etc.
Instances menüsü şöyle
Instances —This shows you all the details of your running and stopped instances.Launch Templates — Create a template that specifies the instance configuration, permissions, best practices and use it to automatically launch instances using autoscaling and EC2 fleet.Spot Requests — In EC2 you can launch spot instances for non-critical tasks. These instances offer up to 90% discount as compared to On-demand instances. You can see the status of your spot requests here.Reserved Instances — ...
Kullanım
Şöyle yaparız
This section will provide details about the AWS Setup to get your EC2 instance up and running.- Login into the AWS Console > Navigate to the EC2 Service Dashboard- Goto the Security Group > Create a new security-group “web-access-security-group” with Inbound Rules for SSH, HTTP and HTTPS. You can name the group whatever you want.- Go back to EC2 DashBoard -> Launch Instance Wizard- Select the Amazon Linux AMI — You choose which ever distribution works for you.- Name the EC2 Instance — StudentAppWebServer- You can keep the instance type to t2.micro. Depending on the requirement, you can select the appropriate type for your application.- Select/Generate a key pair — This is very important as this will be required to SSH into the instance.- Select Existing Security Group — web-access-security-group- You can choose to modify the VPC as per your convenience but I will be using the default to demonstrate this setup.- Keep rest of the settings as default and “Launch Instance”- Once this is done you will see an instance running on your instances view dashboard.- Click on the instance, and go to the details. Copy the PUBLIC IP associated to the instance. This will be used to SSH into the instance.
Bu Linux'a ssh açmak için şöyle yaparız
# Navigate to the key pair and modify the permissions if not done already. # If the permissions is set to 644 then you will be denied to ssh into the instance. > chmod 600 <key-pair.pem> # SSH into the instance. Username changes on the basis of the image you are using. > ssh -i /path/keypair.pem ec2-user@<Instance-Public-IP>
Adımlar şöyle
1. Login to the AWS console2. Switch to Services -> EC2 -> Launch Instance
Şeklen şöyle
Instance Type ve Create New Key Pair Penceresi
Şeklen şöyle. Burada t2.medium seçili
New Security Group Penceresi
Şeklen şöyle.
Eğer VPC ile yaratılmış security group varsa onu seçmek için şöyle yaparızConfigure Storage Penceresi
Şeklen şöyle.
Summary Penceresi
Şeklen şöyle.
Instances Penceresi
Şeklen şöyle.
Bir tanesini seçeriz. Şeklen şöyle.
Şeklen şöyle.. SSH Client sekmesine geçersek, tarayıcı içinde bir terminal çalışmaya başlar.Örnek - Lightsail
Açıklaması şöyle
Amazon Lightsail, launched in 2016, is essentially a virtual private server (VPS) that offers you everything needed to deploy an application or website in a cost-effective and easy-to-understand manner. It is a basic service, but extremely convenient.
It is designed for customers, developers, small businesses, or startups to get quickly started in AWS. It reduces the learning curve in the beginning, and users can later adopt the broad AWS Services as they get more familiar with the AWS cloud and/or solution workload increases.
Under the hood, Lightsail is powered by Amazon EC2, Application Load Balancer (ALB), and other AWS services. By doing this, it offers the level of security, reliability, and scalability you are expecting from AWS.
EC2 Payment Models
Açıklaması şöyle
There are six possible ways to define your payment model for Amazon EC2 instances:1. On-Demand – which is the most flexible one, but the most expensive-looking in a long run2. Compute Savings Plans – are the most flexible out of the saving plans, with cost reduction up to 66%. With this plan it’s possible to change compute instances from one type to another, also apply different sizes and shift workloads from one region to another, or even move from EC2 to Fargate or Lambda. All within the same plan.3. EC2 Instance Savings Plans – this plan costs the least, with cost reductions of up to 72%. But you need to commit to an individual instance type in a region. In the region, you have the flexibility to change usage within the same family instance.4. Reserved Instances- Standard RI – capacity reservations that recur on a daily, weekly, or monthly basis. Typically provide the highest discount levels.- Convertible RI – if you don’t have a good understanding of your long-term requirements you can choose Convertible RI, as they enable you to change the instance family and other parameters associated with a Reserved Instance at any time, as many times as you need. They offer a significant discount (typically 45% compared to On-Demand).5. Spot Instances – unused EC2 instances that run whenever capacity is available and can be purchased for a smaller price than the On-Demand instances. You can see pricing options here.
EC2 ve EBS Storage
EC2'ye EBS depolama ilave edilebilir. Açıklaması şöyle
You can also add block storage volumes to each instance. Amazon Elastic Block Storage is designed for use with EC2 for throughput and transaction-intensive workloads, such as relational and non-relational databases, containerized applications, file systems, and more.
Dosya Kopyalama
Örnek
Şöyle yaparız
# Format scp -i <path to key pair> <jar file path> ec2-user@<public DNS of EC2>:<destination path> # Example scp -i Desktop/ec2-key-pair.pem Desktop/demo-1.0-SNAPSHOT.jar \ ec2-user@ec2-44-71-215-49.compute-1.amazonaws.com:~
Aynı şeyi bash haline getirmek için şöyle yaparız
#!/bin/bash echo "Source Origin: $1" echo "Connecting to $2" scp -i ec2-key-pair.pem $1 ec2-user@$2.compute-1.amazonaws.com:~
Dosyaya hak veririz
chmod u+x aws-copy.sh
ve çalıştırırız
./aws-copy.sh Desktop/demo-app.jar ec2-12-12-12-12
EC2 shell
Örnek
Şöyle yaparız
# Format ssh -i <path to key pair> <jar file path> ec2-user@<public DNS of EC2>:~ ssh -i Desktop/ec2-key-pair.pem ec2-user@ec2-44-71-215-49.compute-1.amazonaws.com
Aynı şeyi bash haline getirmek için şöyle yaparız
#!/bin/bash echo "Connecting to $1" ssh -i Desktop/ec2-key-pair.pem ec2-user@$1.compute-1.amazonaws.com
ve çalıştırırız
./aws-ec2.sh ec2-12-12-12-12
Hiç yorum yok:
Yorum Gönder