Upload
takaoka-susumu
View
656
Download
0
Embed Size (px)
Citation preview
AWS & Amazon EC2
AWS Amazon EC2 Amazon EC2 EC2 EC2 IPElastic IP SSH/RDPApache/IIS
Amazon EC2 (CDP) Snapshot EC2 Stamp CPU Scale Up Ondemand Disk
Amazon EC2 Amazon EC2
OS Linux (Amazon Linux) SSHApache SSH
Windows (Windows Server 2012 R2) (RDP) IIS SSHAdministrator
Linux
Windows
Linux Windows Linux Windows
OSWindows, Mac
AWS
AWSAWSAWS
PC
http://aws.amazon.com/jp/register-flow/
http://console.aws.amazon.com/
FireFox Chrome WindowsSSH TeraTerm (TTSSH2)
http://sourceforge.jp/projects/ttssh2/
Mac AppStoreMicrosoft Remote Desktop
Linux
Windows
Amazon EC2Amazon EC2
Amazon
IT
IT
Mobile Analytics, Cognito, SNS
40
CloudFront
VPC, Route 53, Direct Connect
IAM, Cloud Trail, Cloud HSM, KMS,Config
Cloud Watch,
Trusted Advisor
Elastic Beanstalk,Cloud Formation,
OpsWorks
ManagementConsole, CLI
& SDKs Java,
PHP, .NET, Python, Ruby
AZ Region
EC2, Auto Scaling, ELB, Lambda, ECS
WorkSpaces, WorkDoc, WorkMail
EBS, S3, Glacier, Storage Gateway
RDS, DynamoDB, Redshift,
ElastiCache
EMR, Kinesis, Data Pipeline, Machine Learning
AppStream, Cloud Search, SWF, SQS, SES, Elastic Transcoder
DirectoryService
CodeDeploy,CodeCommit,CodePipeline
1_Blank
Amazon EC2
EC21:
0
EC22:
Thur. Fri. Sun. Mon. Tue. Sat. Wed.
AWS
EC23: EC
2
4/12/2008
(5000)
4/14/2008 4/16/2008 4/18/2008 4/20/2008
EC24: 5
5
1,000
AZEC2
= 9
(GovCloud) (: AZ)
(AZ)
AZ
( )
()
A
EC2
B
GovCloud
EC2
() CPU http://aws.amazon.com/jp/ec2/instance-types/
Medium Large XLarge 2XLarge 4XLarge 8XLarge
256
128
64
32
16
8
4
1
1 2 4 8 16 32
vCPU (Hyper Threading)
Mem
ory (GB)
t2.smallt2.micro
M3
C3/C4
R3
I2/D2
G2 GPUt2.large
t2.medium
10 GB Inter-
Instance Network
M4
OS// &
The image cannot be displayed
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.
Amazon EC2EC2
EC2 () () VPC
(A) () (t2.micro)
() 1
AMI (/ ) Amazon Linux 64bit Windows Server 2012 64bit
() 80 (HTTP)22 (SSH)3389 (RDP)
Linux Windows
1
AWSLinuxEC2 LinuxWindows
AWSEC2
EC22
EC2SSH SSH
ProdKeyDevKeyLabKey
Linux
(TCP/UDP) IP / Security Group
EC2
22(SSH)
80(HTTP)
EC2
25(SMTP)
WebDB
Web
Web
DB
sg-web
sg-web
sg-db
Web
sg-xxx
3306
3306
22,80
22,80 3306
OK
OK
OK
OK NG
sg-web
22: 0.0.0.0/080: 0.0.0.0/0
sg-db
22: 0.0.0.0/03306: sg-web
23
AWS Management ConsoleAWShttp://aws.amazon.com/AWS Management Console
1. []
24
AWS Management Console AWS
1.
3.
4. []
2. []
25
AWS Management Console AWS Management Console1. []
AWS
26
2. [ ()]
1.
27
Amazon EC2 EC2
1. []
3. [EC2]
2. []
28
1. [EC2 ]
2. []
29
AMI() AMIAmazon Linux AMI 201X.XX.XX (HVM) 64-bit
1. []
Linux
30
AMI() AMI Windws 2012 R2
3. []
2. [Windows_Server-2012-R2_RTM-Japanese-64Bit-Base]
1. [ AMI]
Windows
31
t2.micro
1. [t2.micro]
2. []
32
1. [1]
2. [vpc-xxxx (172.31.0.0/16)]
3. [ ap-northeast-1a]
5. []
4. []
33
1. []
34
NameWebServer
1. [Name]
2. [WebServer #1]
3. []
35
(1/2)
1. []
36
(2/2) SSHRDPHTTPOSSSH/RDPHTTP
1. [] 4. []
2. [RDP]
6. []
7. []
3. [] 5. [HTTP]
37
1. []
38
(1/2) demo-keydemo-key.pem
2. [demo-key]
3. []
1. [ ]
39
(2/2)
1. [ ]
40
1. []
41
pendingrunning2/2
42
1.
43
1. [t2.micro]
2. [launch-wizard-1] []
44
DNSIP
DNS
IP
Elastic IP
IP
Amazon EC2EC2
3 running : (Stop) stopped stopped : (Start) running terminated: (Terminate) /
AMI running
terminated
stopped
Start
Stop
TerminateLaunch
()
Terminate
47
EC2
1.
2. [ ] - []
48
EC2 EBSt2.micro
1. []
49
EC2
[running] [stopped]
50
EC2
1.
2. [] []
3. []
Amazon EC2IP
Elastic IP
2IP 2IP1) IP DNS (*.amazonaws.com) IP IP
2) IP DNS (*.internal) IP IP
IP Elastic IP (EIP) EC2
: Elastic IP (EIP) IPEIP EIPIP Route 53(DNS)EIP
URL
https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request
54
IP IPElastic IP
1. [Elastic IP]
2. []
55
IP EC2IP
1. [] 2. []
56
IP IP
1. IP
2. []
57
IP
1.
3. []
2. [WebServer]
58
IP ID
IP
59
IP IP
1. []
2.
3.IP (Elastic IP)
Amazon EC2SSH/RDPApache/IIS
SSH SSH IP (Elastic IP) ec2-user
(demo-key.pem)
Linux
WindowsSSH WindowsTeraTerm TeraTerm (ttssh.exe) http://sourceforge.jp/projects/ttssh2/ Elastic IP SSH2
1
2
3 4
Linux
WindowsSSH : ec2-user KeyPair
1
2 3
5
67
4. (*.*) ()
Linux
MacSSH Mac Terminal (600)
$ chmod 600 ~/Downloads/demo-key.pem$ ssh -i ~/Downloads/demo-key.pem ec2-user@
Elastic IP
Linux
RDP
(demo-key.pem) Elastic IP RDP
Elastic IP Administrator
Windows
66
Windows 1015 Get Windows Password
2. [Windows ]
1.
Windows
67
Windows demo-key.pem
1. [Browse] demo-key.pem
2. 3. []
Windows
68
Windows OS
1. 2. []
Windows
WindowsRDP Windows Windows 7
- -
Windows 8
1. Elastic IP
2. [Administrator]
3. []
Windows
MacRDP Mac Microsoft Remote Desktop
1. [New]2.
4. [Start]
3.
Windows
SSH
IP
22(SSH)3389(RDP)
Mac600
Linux
Linux
Windows
Web Webhttpd)
Web (httpd)
Elastic IP
http:///
$ sudo yum -y install httpd
$ sudo service httpd start
$ sudo chkconfig --level 345 httpd on
Linux
WebPowerShell PowerShellInternet Information ServiceIIS)
Web
Elastic IP http:///
Add-WindowsFeature Name Web-Server
Get-Service W3SVC
Windows
Amazon EC2 (CDP)
Snapshot
Snapshot
EC2
EC2
EBS
Snapshot
EBS
AMI AMI
EBS
EBS
EBS
EBS
EBS
EC2
EBSEC2 EC2EBS (Elastic Block Store)
EC21()EBS
EBS EC2
CPU
AZ - a
EC2
Amazon S3
EBS
EBS
AZ - bEC2
EBS EBS
EBS
: EBS (Elastic Block Store) EBSEC2 1GB16TB //IO 1EC2EBS EC2()
(AZ) EBSS3 EBS(AZ)
: EBS (SSD)
(SSD) IOPS (SSD)
SSD SSD
1TB 16TB 16TB
$0.05 /GB $0.10 /GB $0.125 /GB
IO IO$0.05 / iops IO
$0.065 /piops
IOPS
100 IOPS IOPS
1,000 GiB 3,000 IOPS 3 IOPS/GiB 10,000
IOPS
20,000 IOPS
40-90MB/s 160MB/s 320MB/s
2016215
: EBS vs ( ) EBS
() EBS
DB (Ephemeral Disk)
()
AZ - a
EC2
Amazon S3
EBS
EBSEBS
EBS EBSS3 S399.999999999%()
2 (S3) EBS () AMI
Amazon Simple Storage Service
(S3)Snapshot
EBS
EBS
2015 9 16 SLA
Snapshot
83
1. []
2.
3. [] EC2
84
1.
2. []
85
1. [Name]
2. [] 3. []
86
1. []
2. [completed]
Snapshot
EBS
88
EBS (EBS)
2. []
1. EBS
89
EBS EBSap-northeast-1a (AZ a)
1. [(SSD)]
2. [ap-northeast-1a]
3. [] 4. []
90
EBS EBSEC2
2. [] EBS
1. []
()
Snapshot AMI
92
AMI EBSAMI
3. []
2. AMI
1. []
Linux
AMI Snapshot Pattern [x86_64] (AMI)
1. [Snapshot Pattern]
2. [x86_64]
4. []
3. []
Linux
5. []
94
AMI AMIEC2
2. AMI
1. [] [AMI]
Linux
AMI WindowsAMIStampEC2AMI
AMI1. 2. EC2AMIEC23. 4. 5. 16. EC27. EC2AMI
Windows
Amazon EC2 (CDP)EC2
Stamp
EC2Stamp
EC2AMIAMIEC2
AMIEC2
AMIEC2 AMI AMI21. ()2. EC2()
EC2
Stamp
EC2 EC2
AMI
AMI
AMI (Amazon Machine Image) AMI
AWSAMI
https://aws.amazon.com/amis/ https://aws.amazon.com/
marketplace/ AMI (AMI)
AMIEC2
AMI
Amazon Simple Storage
Service (S3)
Amazon LinuxAMI
Availability Zone
Custom AMI
AMI
AMI
AMI
Stamp EC2AMI
http://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/ec2-instances-and-amis.html
EC2Config EC2 Windows AMI EC2 ConfigService SettingsSysprep, Windows
Set Computer Name User Data Eventlog Wallpaper Information
Windows
Sysprep EC2 ConfigService SettingssysprepOS
1. [Image]
2. [Random]
4. []3. [Shutdown with Sysprep]
Windows
103
EC2AMI EC2AMI
3. [] []
2. AMI
1. []
104
EC2AMI Stamp Pattern
1. [Stamp Pattern]
2. []
[]AMI
105
EC2AMI
[]
106
AMI AMI
1. [AMI]
2. AMI
2. AMI [available]
Stamp AMI
EC2
108
AMIEC2 AMIEC2
1. [] [AMI]
2. AMI
3. []
109
t2.micro:
1. [t2.micro]
2. []
110
b c
1. [1]
2. [vpc-xxxx (172.31.0.0/16)]
3. [ ap-northeast-1b] [ ap-northeast-1c]
5. []
4. []
111
1. []
112
1. [1]
2. []
113
launch-wizard-1
1. []
2. [launch-wizard-1]
3. []
114
1. []
115
demo-key
1. []
2. [demo-key]
4. []
3.
116
1. []
117
EC2 [] 1Web
1. [] []
EC2
EC2
Amazon EC2 (CDP)CPU
Scale Up
CPUScale Up
CPU
EC2()
EC2
ScaleUp
Small
Micro
XLarge
Scale Up
122
EC2
2.
1. [] []
3. [] []
123
()
2. [] []
1.
124
() m3.medium
1. [m3.medium]
2. []
[EBS] EC2EBSI/OSSD EBS
125
EC2 m3.medium
1.
[m3.medium]
2. [] []
126
() t2.micro
2. [] []
1.
127
() t2.micro
1. [t2.micro]
2. []
Amazon EC2 (CDP)
Ondemand Disk
Ondemand Disk
EC22
EC2
Ondemand Disk
10G 100G
RAID 0
EBSEBS
EBS
EBS
EBS
Ondemand Disk
132
EC2AZ EBSAZAZWebServer
2. [WebServer]
1. [] []
3. [ap-northeast-1a]
133
EBS() EC2WebServer
2. []
1. []
134
EBS() 10GiBEC2WebServerAZ[ap-northeast-1a]
1. [ (SSD)]
3. [ap-northeast-1a]
4. []
2. [10] GiB
135
EBSEC2WebServer
1.
2. []
136
EBSEC2WebServer
1. [WebServer]
2. []
137
OS OSEC2ssh
/ebs
$ sudo mkfs -t ext4 /dev/xvdf
$ sudo mkdir /ebs$ sudo mount /dev/xvdf /ebs
$ ls /ebs
Linux
138
OS
2.
13. []
4. []5. [OK]
Windows
139
OS
1. [ ]
Windows
140
OS Windows
141
OS Windows
142
OS Windows
Ondemand Disk
EC2
Amazon S3
EBS
EBS(10GB)
1. EC2
2. EBS3.
EBS4. EBSEC2
()5. EBSEC2
6. EC27. OS
()
EBS(20GB)
145
EBS(AZ)
1. [] []
2. [WebServer]
3. [ap-northeast-1a]
146
EC2
2.
1. [] []
3. [] []
147
2. EBS ID
Root DeviceAMI/dev/xvda /dev/sda1
1.
148
2.
3. []
1.
149
Extend Snapshot
1. [Extend Snapshot]
2. []
3. ID
150
EBS
2. 3. [ ]
1.
151
50GiBGeneral Purpose (SSD)EC2AZ [ap-northeast-1a]ID
1. [General Purpose (SSD)]
2. [50] GiB
3. [ap-northeast-1a]
4. [] 6. []
5. ID
152
EBS ( [WebServer] [/dev/xvda] [/dev/sda1]) EC2()
3.
2. [] [(WebServer):/dev/xvda] [(WebServer):/dev/sda1]
4. [] 1. [ELASTIC BLOCK STORE]
[]
153
()
1. []
154
1. ID
3. [ ]
2.
155
EC2WebServer [/dev/sda1] [/dev/xvda]
1. [WebServer]
2. [/dev/xvda] [/dev/sda1]
3. []
156
EC2 EC2WebServer
1.
2. [] []
3. []
157
Amazon LinuxLinux OS
OSEC2ssh
Size7.9G (8GB)
$ df -h
Filesystem Size Used Avail Use% /dev/xvda1 7.9G 971M 6.9G 13% /
Linux
158
$ sudo resize2fs /dev/xvda1
$ sudo resize2fs /dev/xvda1resize2fs 1.42 (29-Nov-2011)Filesystem at /dev/xvda1 is mounted on /; on-line resizing requiredold_desc_blocks = 1, new_desc_blocks = 2Performing an on-line resize of /dev/xvda1 to 5242880 (4k) blocks.The filesystem on /dev/xvda1 is now 5242880 blocks long.
Linux
159
OS
Size20G
$ df -h
Filesystem Size Used Avail Use% /dev/xvda1 20G 975M 19G 5% /
Linux
160
OS
1. []
Windows
161
Windows
162
Windows
Amazon EC2
850 2016215
()
Amazon EC2 2.4 /
Amazon S3 4 / 1GB / 1
1120
16.8 / 1GB
Amazon EBS 14.4/1GB/ 1
AWSEC2EC2EBSOK5%15%
Simple Monthly CalculatorWeb
http://calculator.s3.amazonaws.com/calc5.html?lng=ja_JP
()
() 1 or 3/
()
EC2
Upfront()()
1 1 : 24% ~ 40%
1 / 3 1 : 27% ~ 49%3 : 50% ~ 67%
() 1 / 3 1 : 28% ~ 50%3 : 53% ~ 69%
3 66%RI
1
< (101)
>
API
Amazon EC2
EC2AWS CLI ()AWS SDKs ()EC2AWS
[]
AWS Command Line Interface (CLI)AWSAWS
EC2
# EC2$ aws ec2 describe-instances
# help$ aws ec2 help$ aws ec2 describe-instances help
AWS Tools for Windows PowerShellAWS 550 AWS SDK for .NET
EC2, S3 http://aws.amazon.com/jp/powershell/
AWS SDKsAWSSDK http://aws.amazon.com/jp/tools/
EC2EC2API http169.254.169.254 /latest/meta-data/ Key
# EC2$ curl http://169.254.169.254/latest/meta-data/ami-idami-launch-indexami-manifest-pathblock-device-mapping/hostnameinstance-actioninstance-idInstance-typekernel-id
Web EC220
EBS500020TB Web http://aws.amazon.com/jp/contact-us/
AWS http://aws.amazon.com/jp/free/ 1 EC2 EC2 Linux 750 Microsoft Windows Server 750 Red Hat Enterprise Linux 750 SUSE Linux Enterprise Server 750
EBS 30 GB 200 I/O 1GB
15 GB
AWS1.
[] - []
2. AMI AMI []
3. []
4. []
5. Elastic IP Elastic IP []