{
"Version": "2012-10-17",
"Statement": [
{
"Action": ["s3:GetObject"],
"Effect": "Allow",
"Resource": "BUCKET_ARN/*",
"Principal": "*"
}
]
}
<bucket-name>
(must be globally unique and follow naming rules - consider adding a timestamp for uniqueness)<!DOCTYPE html>
<title>Static Website on Amazon S3</title>
<style>
body {
text-align: center;
padding: 150px;
}
h1 {
font-size: 50px;
}
body {
font: 20px Helvetica, sans-serif;
color: #333;
}
article {
display: block;
text-align: left;
width: 650px;
margin: 0 auto;
}
a {
color: #dc8100;
text-decoration: none;
}
a:hover {
color: #333;
text-decoration: none;
}
.sample {
padding: 10px 20px 10px;
border-top: groove;
border-bottom: groove;
}
</style>
<article>
<div class="sample">
<h1>Welcome to my website!</h1>
</div>
</article>
index.html
https://bucketName.s3-website.region.amazonaws.com
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::[bucket-name]/index.html"
}
]
}
SELECT * FROM s3object s LIMIT 5
SELECT COUNT(s.gender) AS "Your Alias" FROM s3object s
SELECT MAX(s.your_attribute) AS "Your Alias" FROM s3object s WHERE condition
SELECT MIN(s.your_attribute) AS "Your Alias" FROM s3object s WHERE condition
SELECT AVG (s.your_attribute) AS "Your Alias" FROM s3object s
SELECT CAST(AVG(s.your_attribute) AS INT) AS "Your Alias" FROM s3object s WHERE condition
<instance-name>
<key-pair-name>
<security-group-name>
<security-group-description>
ssh -i <your-key.pem> <ec2-user@your-ec2-public-dns>
sudo apt update
and sudo apt upgrade -y
sudo apt install mysql-server -y
sudo mysql_secure_installation
sudo mysql -u root -p
CREATE DATABASE <database-name>;
SHOW DATABASES;
CREATE USER '<user-name>'@'localhost' IDENTIFIED BY '<password>';
SELECT User, Host FROM mysql.user;
GRANT ALL PRIVILEGES ON <user-name>.* TO '<user-name>'@'localhost';
FLUSH PRIVILEGES;
exit
<db-name>
<db-description>
My IP
db.t2.micro
or db.t3.micro
instance type<db-instance-unique-name>
<unique-connection-name>
Create DATABASE EmployeesDB;
USE EmployeesDB;
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Salary DECIMAL(10, 2)
);
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (1, 'Jose Rizal', 25, 50000.
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (2, 'Andres Bonifacio', 25, 50000.00);
INSERT INTO Employees (ID, Name, Age, Salary)
VALUES (3, 'Emilio Aguinaldo', 25, 50000.00);
SELECT * FROM Employees;
<db-name>
create new
<vpc-name>
<ec2-name>
<key-pair-name>
<security-group-name>
<security-group-description>
<db-of-rds-instance>
Connect to an EC2 instance
ssh -i </path/to/your-key-pair.pem> ec2-user@<your-ec2-public-dns>
Install a MySQL Client Application
sudo dnf install mariadb105
Navigate to EC2 Console > Security Groups > DB-SG
Connect to the RDS Instance from EC2
mysql -h <your-rds-endpoint> -P 3306 -u <your-master-username> -p
SHOW DATABASES;
Create a database and table
Create DATABASE EmployeesDB;
SHOW DATABASES;
USE EmployeesDB;
CREATE TABLE Employees (
ID INT PRIMARY KEY,
Name VARCHAR(50),
Age INT,
Salary DECIMAL(10, 2)
);
DESCRIBE Employees;
<table-name>
<db-name>
001
(string)Product 101
(string)Example
(string)100.1
(number)100
(number)002
(string)Product 102
(string)Example
(string)100.2
(number)102
(number)003
(string)Product 103
(string)Example Two
(string)100.3
(number)103
(number)<name-of-your-table>
<dynamodb-backup-name>