Signup - Go to http://aws.amazon.com - Create new account

advertisement
Signup
- Go to http://aws.amazon.com
- Create new account
- You will be asked for credit card info. You will only be charged if you surpass "free tier" usage.
- 1 year of resources listed earlier.
Sign in
- Console overview
- top right: shows current region
- right side: service health status
- services broken down by category (compute, databse, analytics, etc)
- Before we create any databases, we must create a security group to put it in.
- Click on EC2
- Click Security Groups on left side. There should already be one. This is the default.
- Click Create Security group.
- Name: rds-sg
- Description: "for rds"
- On inbound tab, click "Add Rule"
- For type, select MySQL. Automatically sets port for you
- Source: set to "Anywhere"
- Click on cube on top right to go back to main page.
- Click on RDS - to RDS Dashboard
- Summary of your usage on top
- Down left side: management areas
- Parameter groups - you can create a group with a template of parameters, and assign to RDS
instances
- Option groups - Similar to parameter groups, but for database options, such as Oracle Database
Control, Oracle Advanced Security, SQL Server data encryption, etc
- Subnet group -Similar to parameter and option groups. You create group where all databases
will be on the same subnet. Helpful for Postgres where access control is usually handled by IP address
or subnet
- Events are for monitoring / alerting of things that happen or break with your RDS instance
Launch Instance
- Click "Launch Instance" button
- Select engine - pick MySQL
- Asks if its for production use? Will automatically configure some options, like Multi-AZ and
provisioned IOPs
http://aws.amazon.com/rds/multi-az/
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.ProvisionedIOPS.html
- Click No, then Next
- DB Details:
- License model - mysql only has general public. Other databases would have more options
- DB instance class - pick the size of the instance. Click "Learn More" for specs. Pricing here:
http://aws.amazon.com/rds/pricing/
Pick t1.micro
- Multi-AZ deployment: No
- Storage: minimum 5gb, max 3tb. Set to 5gb
- Provisioned IOPS: No
- DB instance identifier: testdb
- Master user: masteruser
- Master password: masterpw (twice)
- Click Next to Advanced Setings. Some stuff in here is platform specific
- VPC - "Virtual Private Cloud" - This is for dedicated area of Amazon if you wish to pay for it. We dont,
so just take default.
- Publicly accessible - If you set to "no", only services inside the current VPC can reach your database.
If you say "yes", you can access from outside this VPC, but you should setup a good security group.
- Availability Zone: no preference
- Security group: Select rds-sg (remember, we opened up access to reach mysql)
- Database Name - this is the name of the first database you want to create inside the instance. Set to
"mydb"
- Database port: Leave at 3306
- Parameter group & option group: Leave at default
- Backup - retention period for automated backups
- Backup window - set the time range you want to allow backups to run
- Select window. Set start time, and duration. This sets allowable window for backup to run. It
can start anytime in that window.
- Auto minor upgrade - enables auto upgrades of minor versions (5.6.19 -> 5.6.20, etc)
- Maintenance window - similar to backup window - upgrade can happen anytime during that
window. If you enable auto upgrade but dont select a window, Amazon picks a random time.
- IMPORTANT: You can leave this disabled most of the time, and only turn it on for a while until
the upgrade happens, then turn it off again!
- Click LAUNCH!
- click "View your DB instances on the DB instances page"
- Can see status as "creating". Click refresh icon at top to get a new view.
- Can click triangle next to database name to get details.
--- Database creation can take several minutes --- While creating: click "Instance Actions". Some things are grayed out until instance is ready.
- Most of the options are self explanatory.
- If you click "delete", its GONE!! Bye bye. You will still have backups / snapshots, but the live
instance is gone.
- click Logs - once there are logs available, you will see them here. Things like error log, slow query
log, etc
- On left side, click "Snapshots". All your snapshots / backups are listed here, including automated
snapshots. Can take a manual snapshot if you want to.
- Click "Parameter goups".
- Click "Create DB Parameter Group"
- Parameter group family - specifies all databases of that type to be affected. Select mysql5.6
- Group name - "param-group-1"
- Description - "test description"
- On list, select "param-group-1", then click "Edit parameters"
- Initially shows all defaults. Change whatever you want here.
- Some values are variables to be calculated based on other values.
- Example: go to innodb_buffer_pool_size. {DBInstanceClassMemory*3/4} This is dyanmically
setting buffer pool size to 3/4ths of physical memory
- You can override by setting literal value
- Once created, you can assign any database to that parameter group, and that database will
inherit those parameter settings
- Click back to "Instances"
- Click "Show Monitoring". Select testdb instance. You can see performance graphs here.
- Under graphs, you can see CloudWatch Alarms - here you can set alerts to notify you if certain
thresholds are met (running out of memory, etc)
Connect to it, create tables
- Once instance is created, you can connect to it using any mysql client
- On instance info, "endpoint" is hostname. Example: testdb.cddtq1azpyzo.us-east1.rds.amazonaws.com
- Mysql commandline client:
mysql -u masteruser -p -h testdb.cddtq1azpyzo.us-east-1.rds.amazonaws.com
mysql> show databases;
mysql> use mydb;
mysql> show tables;
mysql> create table test1 (col1 int);
mysql> desc test1;
mysql> insert into test1 values (5);
mysql> select * from test1;
Take snapshot
- On left side, click Snapshots
- Click "Create Snapshot"
- DB Instance: testdb should already be selected (its the only one we have!)
- Snapshot name: snap1
- Click Yes, Create
- Will take a few minutes. You can go about your business.
Create replica
- Click Instances
-- BEFORE WE DO THIS!! -> Remember, "Free Tier" only gives you ONE (1, uno, solo) RDS instance. If
you create a replica, you have surpassed one instance, and you will pay for it.
- Click Instance Actions -> Create Read Replica
- Note: New replica will inherit master's security groups and parameter goups
- DB Instance identifier: "replica"
- You CAN change instance size if you want
- All other settings, can leave default
- Click Create. Will take a few minutes.
- Back on instance list you can see it being created
- When completed, you can connect and read from the slave the same as you can the master. Slave
will be read-only.
-- BE SURE TO DELETE ALL INSTANCES WHEN YOU ARE DONE!
Download