LoginSignup
0
0

More than 1 year has passed since last update.

実践CloudFormation Workspaces編

Last updated at Posted at 2020-11-15

最後!!

まずは少し設定しないと行けないのでWorkSpacesへと移動します

ADと検索でActive Directoryを選択

スクリーンショット 2020-10-06 3.12.53.png

CloudFormationで作成されたADを選択

スクリーンショット 2020-10-06 3.13.43.png

アプリ及びサービスの項目でWorkSpcaesを選択

スクリーンショット 2020-10-06 3.14.20.png

移動さきはこんな感じ

スクリーンショット 2020-10-06 3.16.59.png

WorkSpacesの項目を選択してWorkSpacesの起動をクリック

スクリーンショット 2020-10-06 3.17.21.png

サブネットを選択します。
ここではVPC編で作成したルートテーブルに紐づくパブリックサブネットでいいです

スクリーンショット 2020-10-06 3.19.51.png

次のステップを選択(念のため作成されたADを使用しているか確認するのもいいかと)

スクリーンショット 2020-10-06 3.18.36.png

ユーザ情報を入力してユーザーの作成をクリック
スクリーンショット 2020-10-06 3.21.42.png

準備は以上です。
今回したかったことは
ADをWorkSpacesに紐づけるのとサブネットを登録する必要があったこと、そしてユーザーを一人追加する必要があります。

さてCloudFormationに戻ってきましょう

その1

スクリーンショット 2020-10-06 3.23.23.png

WorkSpaces.yamlを選択

いろいろ設定します
OwnBnadleIdはなくてもOK

スクリーンショット 2020-10-06 3.29.13.png

いろいろ設定はデフォでスタックの作成を実行

完成!!

スクリーンショット 2020-10-06 9.46.19.png

 完成後に起動

次のようなメールが届きますのでWorkSpacesを起動しましょう。

スクリーンショット 2020-10-06 9.47.28.png

パスワード設定

スクリーンショット 2020-10-06 9.48.47.png

クライアントソフトをダウンロード

スクリーンショット 2020-10-06 9.49.18.png

アプリを起動してパスワードを入力

スクリーンショット 2020-10-06 9.52.19.png

動いた!!

スクリーンショット 2020-10-06 10.14.02.png

共有フォルダ(FSx)にアクセスできるか確認!!

スクリーンショット 2020-10-06 10.34.01.png

ファイル作成ができるか確認!!

¥¥amznfsxorunjwor.sample.example.com¥share

スクリーンショット 2020-10-06 10.34.31.png

これでリモート環境はできました!!

お疲れ様です

ソースコードの確認

ドキュメント

AWSTemplateFormatVersion: "2010-09-09"
Description: "Create Workspaces"

Mappings:
  WSTypeMap:
    Standard-with-Windows-10-Japanese:
      BundleId: wsb-0ngbndd5g
    Value-with-Windows-10-Japanese:
      BundleId: wsb-gwwsvq6xr
    Performance-with-Windows-10-Japanese:
      BundleId: wsb-dk55sygy0

Parameters:
  WorkstationType:
    AllowedValues:
      - Standard-with-Windows-10-Japanese
      - Value-with-Windows-10-Japanese
      - Performance-with-Windows-10-Japanese
    Description: Select the type of workstation
    Default: Standard-with-Windows-10-Japanese
    Type: String

  OwnBundleId:
    Type: String
    MinLength: '0'
    MaxLength: '63'
    Default: ""
    AllowedPattern: "(^$|^wsb-[0-9a-z]*$)"
    ConstraintDescription: BundleId format is blank or wsb-[alphanumeric characters]. Min characters 8, Max characters 63.

  UserVolumeSizeGibValue:
    Type: "Number"
    Default: 50
    AllowedValues:
      - 10
      - 50
      - 80

  RootVolumeSizeGibValue:
    Type: "Number"
    Default: 80
    AllowedValues: 
     - 80

  # 前提:事前にuserが作成済み(コンソールから作成)
  UserNameValue:
    Type: "String"
    MinLength: '1'
    MaxLength: '63'
    Default: "username"
    AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*"
    ConstraintDescription: must use only alphabet characters. Min 1 Max 63.

  PJPrefix:
    Description: Enter a prefix of this system.
    Type: String
    Default: "test"
    AllowedPattern: "[a-zA-Z][a-zA-Z0-9][ -~]*"
    ConstraintDescription: must begin with a letter and contain only alphanumeric characters.

Conditions:
  WSBundleId: !Equals [ !Ref OwnBundleId, "" ]

Resources:
  WorkSpacesWorkspace:
    Type: "AWS::WorkSpaces::Workspace"
    Properties:
      DirectoryId: { "Fn::ImportValue": !Sub "${PJPrefix}-windows-ad" }
      UserName: !Ref UserNameValue
      BundleId:
        Fn::If: [ WSBundleId,
          !FindInMap [
            WSTypeMap,
            !Ref WorkstationType,
            BundleId
          ],
          !Ref OwnBundleId
        ]
      RootVolumeEncryptionEnabled: false
      UserVolumeEncryptionEnabled: false
      WorkspaceProperties: 
        RunningMode: "AUTO_STOP"
        RunningModeAutoStopTimeoutInMinutes: 60
        RootVolumeSizeGib: !Ref RootVolumeSizeGibValue
        UserVolumeSizeGib: !Ref UserVolumeSizeGibValue
        ComputeTypeName: "STANDARD"
      Tags:
        - Key: Name
          Value: !Sub ${PJPrefix}-WS
Outputs:
  WorkSpaces:
    Value: !Ref WorkSpacesWorkspace
    Export:
      Name: !Sub ${PJPrefix}-windows-ws

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0