Amazon Web Services PDF
Amazon Web Services PDF
Amazon web services
What is AWS?
AWS is a platform which helps businesses scale and grow by offering secure
cloud services like compute power, content delivery, database storage, and
other functionality.
Introduction
AWS full form is Amazon web services. Previously a factory would typically build
an electricity plant and use it for their purposes. Then power experts would
AWS is a growing cloud computing platform which has a significant share
of cloud computing with respect to its competitors. AWS is geographically
diversified into regions to ensure system robustness and outages. In Japan,
Eastern USA, two locations in Western USA, Brazil, Ireland, Singapore, and
Australia regions there are central hubs in place. There are over 100+ services
like application services, networking, storage, mobile, management, compute
and many others which are available for the client easily.
Requirements for Linux/Widows instance Configuration:‐
1.Vpc Configuration
2.Subnets Configuration
3.IGW Configuration
4.RT Configuration
5.SG Configuration
6.Keypairs Configuration
VPC INTRODUCTION:‐
Amazon Virtual Private Cloud (Amazon VPC) lets you provision a logically
isolated section of the AWS Cloud where you can launch AWS resources in a
virtual network that you define. You have complete control over your virtual
networking environment, including selection of your own IP address range,
>>Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
>>In the navigation pane, choose VPC Dashboard in the upper‐left corner.
>>Choose Launch VPC Wizard.
>> Choose VPC with Public and Private Subnets and then choose Select.
>> For IPv4 CIDR block, enter the CIDR block for the VPC. We recommend that
you use a CIDR block from the private (non‐publicly routable) For
example, 10.0.0.0/16. >> For IPv6 CIDR Block, keep No IPv6 CIDR Block.
>> enter a name for the VPC.
>> Hardware tenancy, keep Default
>> Choose Create VPC.
Creating a Subnet in Your VPC:‐
To add a new subnet to your VPC, you must specify an IPv4 CIDR block for the
subnet from the range of your VPC. You can specify the Availability Zone in
which you want the subnet to reside. You can have multiple subnets in the
same Availability Zone.
>> Open the Amazon VPC console
at https://console.aws.amazon.com/vpc/.
>> In the navigation pane, choose Subnets, Create subnet.
>> Specify the subnet details as necessary and choose Create.
>> Name tag: Optional
>> VPC: Choose the VPC for which you're creating the subnet.
>> Availability Zone: Optionally choose an Availability Zone in which your subnet
will reside, or leave the default No Preference to let AWS choose an Availability
Zone for you.
>> IPv4 CIDR block: Specify an IPv4 CIDR block for your subnet
>> Choose Create Subnet
Internet Gateways:‐
An internet gateway is a horizontally scaled, redundant, and highly available
VPC component that allows communication between instances in your VPC and
the internet. It therefore imposes no availability risks or bandwidth constraints
on your network traffic.
An internet gateway serves two purposes: to provide a target in your VPC route
tables for internet‐routable traffic, and to perform network address translation
(NAT) for instances that have been assigned public IPv4 addresses.
An internet gateway supports IPv4 and IPv6 traffic.
Creating and Attaching an Internet Gateway:‐
>> Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
>> In the navigation pane, choose Internet Gateways, and then choose Create
internet gateway.
>> Optionally name your internet gateway, and then choose Create.
>> Select the internet gateway that you just created, and then choose Actions,
Attach to VPC.
>> Select your VPC from the list, and then choose Attach.
To
create a custom route table:‐
>> Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
>> In the navigation pane, choose Route Tables, and then choose Create Route
Table.
>> In the Create Route Table dialog box, optionally name your route table, then
select your VPC, and then choose Yes, Create.
>> Select the custom route table that you just created. The details pane displays
tabs for working with its routes, associations, and route propagation.
>> On the Routes tab, choose Edit, Add another route, and add the following
routes as necessary. Choose Save when you're done.
>> For IPv4 traffic, specify 0.0.0.0/0 in the Destination box, and select the
internet gateway ID in the Target list.
>> On the Subnet Associations tab, choose Edit, select the Associate check box
for the subnet, and then choose Save.
Security Groups for Instances:‐
A security group acts as a virtual firewall that controls the traffic for one or
more instances. When you launch an instance, you can specify one or more
security groups; otherwise, we use the default security group. You can add rules
to each security group that allow traffic to or from its associated instances. You
create a new security group:‐
>> Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
>> In the navigation pane, choose Security Groups, and then choose Create
Security Group.
>> In the Create Security Group dialog box, specify a name for the security
group and a description. Select the ID of your VPC from the VPC list, and then
choose Yes, Create.
>> Select the security group. The details pane displays the details for the
security group, plus tabs for working with its inbound rules and outbound rules.
>> On the Inbound Rules tab, choose Edit. Choose Add Rule, and complete the
required information. For example, select HTTP or HTTPS from the Type list, and
enter the Source as 0.0.0.0/0 for IPv4 traffic, or ::/0 for IPv6 traffic.
Choose Save when you're done.
create your key pair:‐
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> In the navigation pane, under NETWORK & SECURITY, choose Key Pairs.
>> Choose Create Key Pair.
>> For Key pair name, enter a name for the new key pair, and then
choose Create.
>> The private key file is automatically downloaded by your browser. The base
file name is the name you specified as the name of your key pair, and the file
name extension is .pem. Save the private key file in a safe place.
Launch an Instance (LINUX) :‐
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> From the console dashboard, choose Launch Instance.
>> The Choose an Amazon Machine Image (AMI) page displays a list of basic
configurations, called Amazon Machine Images (AMIs), that serve as templates
for your instance. Select an HVM version of Amazon Linux 2. Notice that these
AMIs are marked "Free tier eligible."
>> On the Review Instance Launch page, choose Launch.
>> When prompted for a key pair, select Choose an existing key pair, then select
the key pair that you created when getting set up.
>> Choose View Instances to close the confirmation page and return to the
console.
>> On the Instances screen, you can view the status of the launch. It takes a
short time for an instance to launch. When you launch an instance, its initial
state is pending. After the instance starts, its state changes to running and it
receives a public DNS name.
>> In the Host Name box, enter user_name@public_dns_name
>> Under Connection type, select SSH.
>> In the Category pane, expand Connection, expand SSH, and then
choose Auth.
>> Choose Browse.
>> Select the .ppk file that you generated for your key pair and choose Open.
Transferring Files to Your Linux Instance Using WinSCP:‐
>> Download and install WinSCP from http://winscp.net/eng/download.php.
For most users, the default installation options are OK.
>> At the WinSCP login screen, for Host name, enter the public DNS hostname
or public IPv4 address for your instance.
>> Specify the private key for your instance. For Private key, enter the path to
your private key, or choose the "..." button to browse for the file
>> Choose Login. To add the host fingerprint to the host cache, choose Yes.
>> After the connection is established, in the connection window your Linux
instance is on the right and your local machine is on the left. You can drag and
drop files directly into the remote file system from your local machine.
EBS volumes are highly available and reliable storage volumes that can be
attached to any running instance that is in the same Availability Zone. EBS
volumes that are attached to an EC2 instance are exposed as storage volumes
that persist independently from the life of the instance. With Amazon EBS, you
pay only for what you use.
Amazon EFS supports the Network File System version 4 (NFSv4.1 and NFSv4.0)
protocol, so the applications and tools that you use today work seamlessly with
Amazon EFS. Multiple Amazon EC2 instances can access an Amazon EFS file
system at the same time, providing a common data source for workloads and
applications running on more than one instance or server.
To create Amazon EFS file system:‐
>> Open the Amazon EFS Management Console
at https://console.aws.amazon.com/efs/.
>> Choose Create File System.
>> Choose your default VPC from the VPC list. It has the same VPC ID that you
noted at the end of Step 1: Create Your EC2 Resources and Launch Your EC2
Instance.
>> Select the check boxes for all of the Availability Zones.
>> Choose Next Step.
An Elastic IP address is a public IPv4 address, which is reachable from the
internet. If your instance does not have a public IPv4 address, you can associate
an Elastic IP address with your instance to enable communication with the
internet.
Allocating an Elastic IP Address:‐
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> In the navigation pane, choose Elastic IPs.
>> Choose Allocate new address.
>> For IPv4 address pool, choose Amazon pool.
>> Choose Allocate, and close the confirmation screen.
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> In the navigation pane, choose Elastic IPs.
>> Select an Elastic IP address and choose Actions, Associate address.
When you first create an AWS account, you begin with a single sign‐in identity
that has complete access to all AWS services and resources in the account. This
identity is called the AWS account root user and is accessed by signing in with
the email address and password that you used to create the account. We
strongly recommend that you do not use the root user for your everyday tasks,
even the administrative ones. Instead, adhere to the best practice of using the
root user only to create your first IAM user. Then securely lock away the root
user credentials and use them to perform only a few account and service
management tasks.
Creating IAM Users:‐
>> Sign in to the AWS Management Console and open the IAM console
at https://console.aws.amazon.com/iam/.
>> In the navigation pane, choose Users and then choose Add user.
>> Type the user name for the new user. This is the sign‐in name for AWS. If you
want to add more than one user at the same time, choose Add another user for
each additional user and type their user names. You can add up to 10 users at
one time.
>> Select the type of access this set of users will have. You can select
programmatic access, access to the AWS Management Console, or both.
>> Choose Next: Permissions.
Add user to group. Choose this option if you want to assign the users
to one or more groups that already have permissions policies. IAM
displays a list of the groups in your account, along with their
attached policies. You can select one or more existing groups, or
choose Create group to create a new group.
Copy permissions from existing user. Choose this option to copy all
of the group memberships, attached managed policies, embedded
inline policies, and any existing permissions boundaries from an
existing user to the new users. IAM displays a list of the users in your
account. Select the one whose permissions most closely match the
needs of your new users.
Attach existing policies to user directly. Choose this option to see a
list of the AWS managed and customer managed policies in your
account. Select the policies that you want to attach to the new users
or choose Create policy to open a new browser tab and create a new
policy from scratch.
>> Choose Next: Tags.
>> Choose Next: Review to see all of the choices you made up to this point.
When you are ready to proceed, choose Create user.
Amazon S3:‐
Amazon Simple Storage Service (Amazon S3) is an object storage service that
offers industry‐leading scalability, data availability, security, and performance.
This means customers of all sizes and industries can use it to store and protect
any amount of data for a range of use cases, such as websites, mobile
applications, backup and restore, archive, enterprise applications, IoT devices,
and big data analytics. Amazon S3 provides easy‐to‐use management features
so you can organize your data and configure finely‐tuned access controls to
meet your specific business, organizational, and compliance requirements.
>> Under Storage & Content Delivery, choose S3 to open the Amazon S3
console.
>> From the Amazon S3 console dashboard, choose Create Bucket.
>> In Region, choose Region
>> Choose Create.
Upload a File to Your Amazon S3 Bucket:‐
>> In the Amazon S3 console, choose the bucket where you want to upload an
object, choose Upload, and then choose Add Files.
>> In the file selection dialog box, find the file that you want to upload, choose
it, choose Open, and then choose Start Upload.
>> If you are downloading an object, specify where you want to save it.
>> Within your S3 bucket, select the file that you want to delete,
choose Actions, and then choose Delete.
>> In the confirmation message, choose OK.
Monitoring Step Functions Using CloudWatch:‐
Amazon CloudWatch is a monitoring and management service that provides
data and actionable insights for AWS, hybrid, and on‐premises applications and
infrastructure resources. With CloudWatch, you can collect and access all your
performance and operational data in form of logs and metrics from a single
platform. This allows you to overcome the challenge of monitoring individual
systems and applications in silos (server, network, database, etc.). CloudWatch
enables you to monitor your complete stack (applications, infrastructure, and
services) and leverage alarms, logs, and events data to take automated actions
and reduce Mean Time to Resolution (MTTR). This frees up important resources
and allows you to focus on building applications and business value.
To configure Coudwatch to monitor cpu utilization:‐
>> Lanuch A Amazon linux instance
>> open AWS Console
>> click on services
>> In the management tool Section select Cloudwatch
>> Select Alarams
>> Click on Create alaram
>> Select EC2 metrics
Why do you want a managed relational database service? Because Amazon RDS
takes over many of the difficult or tedious management tasks of a relational
database:
When you buy a server, you get CPU, memory, storage, and IOPS, all
bundled together. With Amazon RDS, these are split apart so that you can
scale them independently. If you need more CPU, less IOPS, or more
storage, you can easily allocate them.
>> In the upper‐right corner of the AWS Management Console, choose the AWS
Region in which you want to create the DB instance. This example uses the US
West (Oregon) Region.
>> In the navigation pane, choose Databases.
>> Choose Create database.
>> On the Create database page, shown following, make sure that the Standard
Create option is chosen, and then choose MySQL.
>> In the Templates section, choose Dev/Test.
>> In the Settings section, set these values:
DB instance identifier – tutorial‐db‐instance
Master username – tutorial_user
Auto generate a password – Disable the option
>> In the DB instance size section, set these values:
DB instance performance type – Burstable
DB instance class – db.t2.small
>> In the Storage and Availability & durability sections, use the default values.
>> In the Connectivity section, open Additional connectivity configuration and
set these values:
Virtual Private Cloud (VPC) – Choose an existing VPC with both public and
private subnets
Subnet group – The DB subnet group for the VPC, such as the tutorial‐db‐
subnet‐group
Publicly accessible – Yes
VPC security groups – Choose an existing VPC security group that is
configured for private access
Availability zone – No Preference
Database port – 3306
>> Open the Additional configuration section, and enter sample for Initial
database name. Keep the default settings for the other options.
>> Wait for the Status of your new DB instance to show as Available. Then
choose the DB instance name to show its details.
>> In the Connectivity & security section, view the Endpoint and Port of the DB
instance.
that sources outside of the VPC cannot connect to your RDS MySQL DB
instance.
AWS Elastic Beanstalk:‐
With Elastic Beanstalk, you can quickly deploy and manage applications in the
AWS Cloud without having to learn about the infrastructure that runs those
applications. Elastic Beanstalk reduces management complexity without
restricting choice or control. You simply upload your application, and Elastic
Beanstalk automatically handles the details of capacity provisioning, load
balancing, scaling, and application health monitoring.
Elastic Beanstalk supports applications developed in Go, Java, .NET, Node.js,
PHP, Python, and Ruby. When you deploy your application, Elastic Beanstalk
builds the selected supported platform version and provisions one or more AWS
resources, such as Amazon EC2 instances, to run your application.
You can interact with Elastic Beanstalk by using the AWS Management Console,
the AWS Command Line Interface (AWS CLI), or eb, a high‐level CLI designed
specifically for Elastic Beanstalk.
Create an Application and an Environment:‐
>> Open the Elastic Beanstalk console.
>> for Platform, choose a platform, and then choose Create application.
>> Creates an Elastic Beanstalk application named getting‐started‐app.
>> Launches an environment named GettingStartedApp‐env with these AWS
resources:
An Amazon Elastic Compute Cloud (Amazon EC2) instance (virtual
machine)
An Amazon EC2 security group
Elastic Load Balancer:‐
A load balancer distributes incoming application traffic across multiple EC2
instances in multiple Availability Zones. This increases the fault tolerance of
your applications. Elastic Load Balancing detects unhealthy instances and routes
traffic only to healthy instances.
Your load balancer serves as a single point of contact for clients. This increases
the availability of your application. You can add and remove instances from
your load balancer as your needs change, without disrupting the overall flow of
A listener checks for connection requests from clients, using the protocol and
port that you configure, and forwards requests to one or more registered
instances using the protocol and port number that you configure. You add one
or more listeners to your load balancer.
You can configure health checks, which are used to monitor the health of the
registered instances so that the load balancer only sends requests to the
healthy instances.
To ensure that your registered instances are able to handle the request load in
each Availability Zone, it is important to keep approximately the same number
of instances in each Availability Zone registered with the load balancer. For
example, if you have ten instances in Availability Zone us‐west‐2a and two
instances in us‐west‐2b, the requests are distributed evenly between the two
Availability Zones. As a result, the two instances in us‐west‐2b serve the same
By default, the load balancer distributes traffic evenly across the Availability
Zones that you enable for your load balancer. To distribute traffic evenly across
all registered instances in all enabled Availability Zones, enable cross‐zone load
balancing on your load balancer. However, we still recommend that you
maintain approximately equivalent numbers of instances in each Availability
Zone for better fault tolerance.
To create a Classic Load Balancer:‐
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> On the navigation bar, choose a region for your load balancer. Be sure to
select the same region that you selected for your EC2 instances.
>> On the navigation pane, under LOAD BALANCING, choose Load Balancers.
>> Choose Create Load Balancer.
>> For Load Balancer, choose Create.
Step 2: Define Your Load Balancer
You must provide a basic configuration for your load balancer, such as a name,
a network, and a listener.
A listener is a process that checks for connection requests. It is configured with
a protocol and a port for front‐end (client to load balancer) connections and a
protocol and a port for back‐end (load balancer to instance) connections. In this
tutorial, you configure a listener that accepts HTTP requests on port 80 and
sends them to your instances on port 80 using HTTP.
To define your load balancer and listener:‐
>> For Load Balancer name, type a name for your load balancer.
>> For Create LB inside, select the same network that you selected for your
instances: EC2‐Classic or a specific VPC.
>> [Default VPC] If you selected a default VPC and would like to choose the
subnets for your load balancer, select Enable advanced VPC configuration.
>> Leave the default listener configuration.
>> [EC2‐VPC] For Available subnets, select at least one available public subnet
using its add icon. The subnet is moved under Selected subnets. To improve the
availability of your load balancer, select more than one public subnet.
You can add at most one subnet per Availability Zone. If you select a subnet
from an Availability Zone where there is already an selected subnet, this subnet
replaces the currently selected subnet for the Availability Zone.
>> Choose Next: Assign Security Groups.
Step 3: Assign Security Groups to Your Load Balancer in a VPC
If you selected a VPC as your network, you must assign your load balancer a
security group that allows inbound traffic to the ports that you specified for
your load balancer and the health checks for your load balancer.
To assign security group to your load balancer:‐
>> On the Assign Security Groups page, select Create a new security group.
>> Type a name and description for your security group, or leave the default
name and description. This new security group contains a rule that allows traffic
to the port that you configured your load balancer to use.
>> Choose Next: Configure Security Settings.
>> Choose Next: Configure Health Check to continue to the next step.
To configure health checks for your instances:‐
>> On the Configure Health Check page, leave Ping Protocol set to HTTP
and Ping Port set to 80.
>> For Ping Path, replace the default value with a single forward slash ("/"). This
tells Elastic Load Balancing to send health check queries to the default home
page for your web server, such as index.html.
>> For Advanced Details, leave the default values.
>> Choose Next: Add EC2 Instances.
Step 5: Register EC2 Instances with Your Load Balancer
Your load balancer distributes traffic between the instances that are registered
to it.
To register EC2 instances with your load balancer
>> On the Add EC2 Instances page, select the instances to register with your
load balancer.
>> Leave cross‐zone load balancing and connection draining enabled.
>> Choose Next: Add Tags.
To create and test your load balancer
>> On the Review page, choose Create.
>> After you are notified that your load balancer was created, choose Close.
>> Select your new load balancer.
>> On the Description tab, check the Status row. If it indicates that some of your
instances are not in service, its probably because they are still in the registration
process
>> After at least one of your EC2 instances is in service, you can test your load
balancer. Copy the string from DNS name (for example, my‐load‐balancer‐
1234567890.us‐west‐2.elb.amazonaws.com) and paste it into the address field
of an Internet‐connected web browser. If your load balancer is working, you see
the default page of your server.
Step 8: Delete Your Load Balancer (Optional)
As soon as your load balancer becomes available, you are billed for each hour or
partial hour that you keep it running. When you no longer need a load balancer,
you can delete it. As soon as the load balancer is deleted, you stop incurring
charges for it.
To delete your load balancer
>> If you have a CNAME record for your domain that points to your load
balancer, point it to a new location and wait for the DNS change to take effect
before deleting your load balancer.
>> On the navigation pane, under LOAD BALANCING, choose Load Balancers.
>> Select the load balancer.
>> Choose Actions, Delete.
>> When prompted for confirmation, choose Yes, Delete.
AWS CloudFormation:‐
AWS CloudFormation is a service that helps you model and set up your Amazon
Web Services resources so that you can spend less time managing those
resources and more time focusing on your applications that run in AWS. You
create a template that describes all the AWS resources that you want (like
Amazon EC2 instances or Amazon RDS DB instances), and AWS CloudFormation
takes care of provisioning and configuring those resources for you.
If your application requires additional availability, you might replicate it in
multiple regions so that if one region becomes unavailable, your users can still
use your application in other regions. The challenge in replicating your
application is that it also requires you to replicate your resources. Not only do
you need to record all the resources that your application requires, but you
must also provision and configure those resources in each region.
When you use AWS CloudFormation, you can reuse your template to set up
your resources consistently and repeatedly. Just describe your resources once
and then provision the same resources over and over in multiple regions.
>> If this is a new AWS CloudFormation account, click Create New Stack.
Otherwise, click Create Stack.
>> In the Template section, select Specify an Amazon S3 Template URL to type
or paste the URL for the sample WordPress template, and then click Next:
>> the Specify Details section, enter a stack name in the Name field. For this
example, use MyWPTestStack. The stack name cannot contain spaces.
>> In the KeyName field, enter the name of a valid Amazon EC2 key pair in the
same region you are creating the stack.
>> Click Next.
>> In this scenario, we won't add any tags. Click Next.
>> Review the information for the stack. When you're satisfied with the
settings, click Create.
>> On the AWS CloudFormation console, select the stack MyWPTestStack in the
list.
>> In the stack details pane, click the Events tab.
>> The console automatically refreshes the event list with the most recent
events every 60 seconds.
To delete the stack and its resources:‐
>> From the AWS CloudFormation console, select the MyWPTestStack stack.
>> Click Delete Stack.
Amazon EC2 instance Migration Service :‐
Migrating involves capturing settings, configurations, and data and porting
these to a newer operating system on separate hardware. After validation, the
migrated system can be promoted to production. You can migrate instances by
launching a new instance from an AMI of the new operating system. You can
streamline the process further by using AWS CloudFormation and AWS Systems
Manager to automatically apply settings and configurations to the new system
with little manual work.
To migrate your server
>> Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
>> In the navigation pane, choose AMIs, Owned by me, and Public images.
>> Launch a new instance from an AMI.
>> Log on to the new instance and install all updates.
>> Perform an application installation and configuration changes.
>> Test the server.
>> When validated, promote the server to production.
>> Create a custom AMI from the target account instance.
>> If you don't need to run any instances of this Amazon EBS‐backed AMI on the
source account, clean up your AMI.
AWS Route53 :‐
Amazon Route 53 is a highly available and scalable Domain Name System (DNS)
web service. You can use Route 53 to perform three main functions in any
combination: domain registration, DNS routing, and health checking. If you
choose to use Route 53 for all three functions, perform the steps in this order:
1. Register domain names
Your website needs a name, such as example.com. Route 53 lets you
register a name for your website or web application, known as a domain
name.
2. Route internet traffic to the resources for your domain
3. Check the health of your resources
Route 53 sends automated requests over the internet to a resource, such
as a web server, to verify that it's reachable, available, and functional. You
also can choose to receive notifications when a resource becomes
unavailable and choose to route internet traffic away from unhealthy
resources.
Create S3 buckets
>> We first need to log in into the AWS management console and look for the S3
service.
>> Once found, we have to create two S3 buckets with our domain name.
>> In my case, I’ll be using the following bucket names:
Bucket 1 — www.testingsite.com
>> You have to make sure that both bucket names are exactly the same as your domain name.
>> You should now be able to see both your S3 buckets.
>> I’ll choose the www version, hence Bucket 1 will be the main bucket for our
site.
>> This means that after we complete all the steps, any user
accessing testingsite.com would be automatically redirected
to www.testingsite.com
>> Hit the Properties tab, and you should be able to see Static website hosting.
>> Open it, select “Use this bucket to host a website” and then you need to type
the index document of your website i.e. index.html in our case.
>> Don’t forget to click the Save button.
>> By default, you should see all settings set to true.
>> Hit the edit button, and then un tick the following settings as shown below.
>> click the save button.
>> add new Bucket Policies for our S3 bucket.
>> go to the Permissions tab of the bucket again and then open the Bucket
Policy tab.
>> Paste into the editor the following policy. Don’t forget to
replace www.testingsite.com with your domain name!
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::www.testingsite.com/*"
}
]
}
>> go back to the Properties tab and then to the Static website hosting option.
>> go to the second bucket, go to the Properties tab and then open Static
website hosting again.
>> Select Redirect requests and then type in your target domain
( www.testingsite.com in my case) and specify the protocol ( http for now).
>> We need to create 2 DNS records with the following characteristics which
will point to our S3 bucket:
Type: A — IPV4 address
Alias: Yes
Alias Target: Our main bucket
>> Once you’ve done the above steps and waited a little bit, you should be
able to see your website if you try accessing your domain.
i.e. www.testingsite.com