Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 3 : サーバーを構築する #2

Merged
merged 3 commits into from
Jan 22, 2017
Merged

Chapter 3 : サーバーを構築する #2

merged 3 commits into from
Jan 22, 2017

Conversation

a-know
Copy link
Owner

@a-know a-know commented Jan 22, 2017

  • セキュリティグループの生成

@a-know
Copy link
Owner Author

a-know commented Jan 22, 2017

AWS の EC2 インスタンス生成ウィザードではセキュリティグループも一緒に新規作成できるが、
CloudFormation を用いる場合は予め作っておいた方がよさそうだったのでまずはその作成を 2bebef6 で実施。

以上を参考に↓のように生成完了。

2017-01-22 11 20 26

2017-01-22 11 20 51

2017-01-22 11 20 58

"MyPublicSecurityGroup": {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "SecurityGroup for web-server instance in public-subnet",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この value には ASCII 文字しか使えなかった

{
"IpProtocol" : "tcp",
"FromPort" : "22",
"ToPort" : "22",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS コンソールで言うところの「タイプ」は、プロトコルやポート番号で自動判定するっぽい

"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"GroupDescription" : "SecurityGroup for web-server instance in public-subnet",
"SecurityGroupIngress" : [
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Egress(アウトバウンド)の方は指定しなければデフォルト(「すべてのトラフィック」をどこへでも( 0.0.0.0/0 )送信可)になる。

"Properties" : {
"ImageId" : "ami-4985b048",
"InstanceType" : "t2.nano",
"KeyName" : "macbook12",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

キーペアは予め作成済みのものを使用。
CloudFormation でキーペアの作成もできるのかな?

"NetworkInterfaces": [
{
"AssociatePublicIpAddress": "true",
"DeviceIndex": "0",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Tags" : [
{ "Key" : "Name", "Value" : "Webサーバー" }
],
"NetworkInterfaces": [
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このプロパティはEC2 NetworkInterface 埋め込みプロパティタイプのドキュメントも参照する。

"GroupSet": [ { "Ref" : "MyPublicSecurityGroup" } ]
}
],
"BlockDeviceMappings" : [
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
"DeviceName" : "/dev/sda1",
"Ebs" : {
"VolumeType" : "standard",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

選択可能なタイプはAmazon EBS Volume Types参照。

standard は全世代のものだが、一応選択可能。

}
},
"MyPublicEC2Instance": {
"Type" : "AWS::EC2::Instance",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS::EC2::Instance の包括的なドキュメントはAWS::EC2::Instance のリファレンス

@a-know
Copy link
Owner Author

a-know commented Jan 22, 2017

2fe4f22 で、本の中で指定しているものと同等のスペック(インスタンスタイプだけ t2.nano にした)・設定のインスタンスを立てられた。

2017-01-22 11 54 57

stopped 状態で生成されて、今回のような学習目的にはマッチするけど、running 状態で構築することもできるのだろうか?(わからない)

@a-know a-know changed the title [WIP] Chapter 3 : サーバーを構築する Chapter 3 : サーバーを構築する Jan 22, 2017
@a-know a-know merged commit aea508f into master Jan 22, 2017
@a-know a-know deleted the chapter-3 branch January 22, 2017 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant