【初心者】第4回 Azure CLI でUbuntuを作成する -ストレージアカウントについて-

◆ Live配信スケジュール ◆
サイオステクノロジーでは、Microsoft MVPの武井による「わかりみの深いシリーズ」など、定期的なLive配信を行っています。
⇒ 詳細スケジュールはこちらから
⇒ 見逃してしまった方はYoutubeチャンネルをご覧ください
【5/21開催】Azure OpenAI ServiceによるRAG実装ガイドを公開しました
生成AIを活用したユースケースで最も一番熱いと言われているRAGの実装ガイドを公開しました。そのガイドの紹介をおこなうイベントです!!
https://tech-lab.connpass.com/event/315703/

はじめに

Azure CLIを利用して、パブリックIPとNICとストレージアカウントを作成する方法をご紹介いたします。前回まで、リソースグループの作成し、仮想ネットワーク(VNet)を作成して、サブネットと割当て、ネットワーク セキュリティ グループを作成、ルールをサブネットに適用させるところまで行いました。今回はインターネット経由でssh接続するために、パブリックIPとNICを作成することと、仮想マシンOS兼データ用ストレージアカウントを作成します。

パブリックIP

パブリックIPアドレスは、staticかdynamicかを選択できます。パブリックIPを実際に仕様するには、ロードバランサーやNICなどと関連付けて利用します。
dynamicの場合、IPアドレスはリソースを停止すると開放され、再開すると新たにIPが割当られます。アドレスを変更したくない場合はstaticを利用します。

料金は、¥0.41/時間 (およそ ¥304/月) で課金されます。関連づけられているリソースやデプロイモデルのタイプによって料金が変動します。
詳細はこちらのページをご参照ください。
参考 : IP アドレスの料金

パブリックIPの作成

次のコマンドで、パブリックIPリソースを作成します。
# azure network public-ip create -g -n -l --allocation-method

resource-group : パブリックIPを作成するリソースグループ名を指定します。
name : パブリックIPのリソース名を指定します。
location : パブリックIPを作成するロケーションを指定します。 ※ locationは# azure location listで一覧を表示することができます。
allocation-method : DynamicかStaticを指定します。デフォルトではDynamicです。

# azure network public-ip create -g TestResourceGroup -n TestPIP -l japaneast --allocation-method Dynamic
info:    Executing command network public-ip create
warn:    Using default --idle-timeout 4
warn:    Using default --ip-version IPv4
+ Looking up the public ip "TestPIP"
+ Creating public ip address "TestPIP"
data:    Id                              : /subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/TestResourceGroup/providers/Microsoft.Network/publicIPAddresses/TestPIP
data:    Name                            : TestPIP
data:    Type                            : Microsoft.Network/publicIPAddresses
data:    Location                        : japaneast
data:    Provisioning state              : Succeeded
data:    Allocation method               : Dynamic
data:    IP version                      : IPv4
data:    Idle timeout in minutes         : 4
info:    network public-ip create command OK

パブリックIPの確認

次のコマンドで作成されたことを確認します。

# azure network public-ip list -g

# azure network public-ip list -g TestResourceGroup
info:    Executing command network public-ip list
+ Getting the public ip addresses
data:    Name     Location   Resource group     Provisioning state  Allocation method  IP version  IP Address  Idle timeout, minutes  FQDN
data:    -------  ---------  -----------------  ------------------  -----------------  ----------  ----------  ---------------------  ----
data:    TestPIP  japaneast  TestResourceGroup  Succeeded           Dynamic            IPv4                    4
info:    network public-ip list command OK

以上で、TestResourceGroupにパブリックIPのリソースを作成することができました。
次にNICを作成します。

NICの作成

次のコマンドで、NICリソースを作成します。
# azure network nic create -g -n -l --network-security-group-name --subnet-name --subnet-vnet-name

# azure network nic create -g TestResourceGroup -n TestNIC -l japaneast --network-security-group-name TestNSG --subnet-name TestSNet --subnet-vnet-name TestVNet
info:    Executing command network nic create
+ Looking up the network interface "TestNIC"
+ Looking up the network security group "TestNSG"
+ Looking up the subnet "TestSNet"
+ Creating network interface "TestNIC2"
data:    Id                              : /subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/TestResourceGroup/providers/Microsoft.Network/networkInterfaces/TestNIC2
data:    Name                            : TestNIC2
data:    Type                            : Microsoft.Network/networkInterfaces
data:    Location                        : japaneast
data:    Provisioning state              : Succeeded
data:    Internal domain name suffix     : cbnnr3x1vnhetja0daxz5lmgza.lx.internal.cloudapp.net
data:    Enable IP forwarding            : false
data:    Network security group          : /subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/TestResourceGroup/providers/Microsoft.Network/networkSecurityGroups/TestNSG
data:    IP configurations:
data:      Name                          : default-ip-config
data:      Primary                       : true
data:      Provisioning state            : Succeeded
data:      Private IP address            : 10.0.0.5
data:      Private IP version            : IPv4
data:      Private IP allocation method  : Dynamic
data:      Subnet                        : /subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/TestResourceGroup/providers/Microsoft.Network/virtualNetworks/TestVNet/subnets/TestSNet
data:
info:    network nic create command OK

NICを確認

次のコマンドでNICが作成されたことを確認します。
# azure network nic list -g

# azure network nic list -g TestResourceGroup
info:    Executing command network nic list
+ Getting the network interfaces
data:    Name      Location   Resource group     Provisioning state  MAC Address  IP forwarding  Internal DNS name  Internal FQDN  Internal domain name suffix
data:    --------  ---------  -----------------  ------------------  -----------  -------------  -----------------  -------------  ---------------------------------------------------
data:    TestNIC   japaneast  TestResourceGroup  Succeeded                        false
info:    network nic list command OK

以上で、TestResourceGroupにNICのリソースを作成することができました。
次にストレージアカウントを作成します。

ストレージアカウント

azure-storage

Azure ストレージ アカウントは、Azure Storage データ オブジェクトを格納しておくものです。Storageはインターネットからもアクセスでき、例えばblob Storageの場合、
<ストレージアカウント名>.blob.core.windows.netのような名前空間が与えられます。その為、ストレージアカウント名はインターネット上で一意である必要があります。

アカウントの種類は、「BLOB ストレージ アカウント」と「汎用ストレージ アカウント」の2種類があります。

BLOB ストレージ アカウントは、BLOBに特化したストレージアカウントです。
汎用ストレージ アカウントは、BLOB、File、Disk、Table、Queueなど様々なタイプのストレージサービスを利用することができます。

参考
Azure ストレージ アカウントについて
Microsoft Azure Storage の概要
Azure Storage 料金

ストレージアカウントの作成

次のコマンドでストレージアカウントを作成します。

# azure storage account create --sku-name --kind -g -l -s

name : ストレージアカウントの名前を指定します。(文字数は3~24,英小文字,数字)
kind : アカウントの種類を指定します(Storage/BlobStorage)。
skuName : SKU名を指定します。(LRS/ZRS/GRS/RAGRS/PLRS)
– LRS(Locally redundant storage): リージョン内のデータが3回レプリケートされる。
– ZRS(Zone-redundant storage): 1 つまたは 2 つのリージョン内の 2 つから 3 つの施設でデータがレプリケートされる。
– GRS(Geo-redundant storage): セカンダリ リージョンにデータがレプリケートされる。
– RAGRS(Read-access geo-redundant storage): GRSに加えて、2次拠点のデータにも読み取り専用アクセスを提供される。
– PLRS:Azure Premium Storage を指定する場合
参考 : Azure Storage のレプリケーション
リソースグループ名を指定
ロケーションを指定
サブスクリプションIDを指定 (※ # azure account listで確認できます。)
# azure storage account create teststorage --sku-name LRS --kind Storage -g TestResourceGroup -l japaneast -s aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
info: Executing command storage account create
+ Checking availability of the storage account name
+ Creating storage account
info: storage account create command OK

ストレージアカウントの確認

次のコマンドで、ストレージアカウントが作成されたことを確認します。
# azure storage account show teststorage -g TestResourceGroup

# azure storage account show teststorage -g TestResourceGroup
info: Executing command storage account show
+ Getting storage account
data: Name: teststorage
data: Url: /subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/testresourcegroup/providers/Microsoft.Storage/storageAccounts/testStorage
data: Type: Microsoft.Storage/storageAccounts
data: SKU Name: Standard_LRS
data: SKU Tier: Standard
data: Kind: Storage
data: Resource Group: testresourcegroup
data: Location: japaneast
data: Provisioning State: Succeeded
data: Primary Location: japaneast
data: Primary Status: available
data: Secondary Location: undefined
data: Creation Time: Tue, 15 Nov 2016 03:32:26 GMT
data: Primary Endpoints: blob https://teststorage.blob.core.windows.net/
data: Primary Endpoints: queue https://teststorage.queue.core.windows.net/
data: Primary Endpoints: table https://teststorage.table.core.windows.net/
data: Primary Endpoints: file https://teststorage.file.core.windows.net/
info: storage account show command OK

TestResourceGroupにteststorageが作成されました。

まとめ

パブリックIPをとストレージアカウントを作成しました。
次回はいよいよ仮想マシンを作成します。

アバター画像
About サイオステクノロジーの中の人です 88 Articles
サイオステクノロジーで働く中の人です。
ご覧いただきありがとうございます! この投稿はお役に立ちましたか?

役に立った 役に立たなかった

0人がこの投稿は役に立ったと言っています。


ご覧いただきありがとうございます。
ブログの最新情報はSNSでも発信しております。
ぜひTwitterのフォロー&Facebookページにいいねをお願い致します!



>> 雑誌等の執筆依頼を受付しております。
   ご希望の方はお気軽にお問い合わせください!

Be the first to comment

Leave a Reply

Your email address will not be published.


*


質問はこちら 閉じる