

Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.

# Erste Schritte mit CloudFormation AWS PCS
<a name="get-started-cfn"></a>

Sie können es verwenden AWS CloudFormation , um einen AWS PCS-Cluster zu erstellen. CloudFormation ermöglicht es Ihnen, AWS Infrastrukturbereitstellungen vorhersehbar und wiederholt zu erstellen und bereitzustellen. Sie können CloudFormation die automatische Bereitstellung von Ressourcen aus vielen AWS Diensten verwenden, um äußerst zuverlässige, skalierbare und kostengünstige Anwendungen zu erstellen, AWS Cloud ohne die zugrunde liegende Infrastruktur erstellen und konfigurieren zu müssen. AWS CloudFormation ermöglicht es Ihnen, mithilfe einer Vorlagendatei eine Sammlung von Ressourcen zu einer einzigen Einheit, einem sogenannten **Stapel**, zu erstellen und zu löschen. Weitere Informationen zu CloudFormation finden Sie unter [Was ist CloudFormation?](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) im *AWS CloudFormation Benutzerhandbuch*. Weitere Informationen zu AWS PCS-Ressourcentypen finden Sie in CloudFormation der [Referenz zu AWS PCS-Ressourcentypen](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PCS.html) im *AWS CloudFormation Benutzerhandbuch*.

**Topics**
+ [Wird verwendet CloudFormation , um einen AWS PCS-Beispielcluster zu erstellen](get-started-cfn-create.md)
+ [Stellen Sie eine Connect zu einem AWS PCS-Cluster her, der erstellt wurde mit CloudFormation](get-started-cfn-connect.md)
+ [Bereinigen Sie einen AWS PCS-Cluster in CloudFormation](get-started-cfn-cleanup.md)
+ [Teile einer CloudFormation Vorlage für AWS PCS](get-started-cfn-template-parts.md)
+ [CloudFormation Vorlagen zum Erstellen eines AWS PCS-Beispielclusters](get-started-cfn-sample-templates.md)

# Wird verwendet CloudFormation , um einen AWS PCS-Beispielcluster zu erstellen
<a name="get-started-cfn-create"></a>

Das folgende Verfahren verwendet eine CloudFormation Vorlage im AWS-Managementkonsole , um einen AWS PCS-Beispielcluster zu erstellen. Weitere Informationen zu CloudFormation finden Sie unter [Was ist CloudFormation?](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) im *AWS CloudFormation Benutzerhandbuch*. Weitere Informationen zu AWS PCS-Ressourcentypen finden Sie in CloudFormation der [Referenz zu AWS PCS-Ressourcentypen](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_PCS.html) im *AWS CloudFormation Benutzerhandbuch*.

**Um den Beispielcluster zu erstellen**

1. Wählen Sie AWS-Region den aus, in dem der Cluster erstellt werden soll (der Link öffnet die CloudFormation Konsole mit der Vorlage):
   + [USA Ost (Nord-Virginia)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (us-east-1)
   + [USA Ost (Ohio)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (us-east-2)
   + [USA West (Oregon)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (us-west-2)
   + [Asien-Pazifik (Mumbai)](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (ap-south-1)
   + [Asien-Pazifik (Singapur)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (ap-southeast-1)
   + [Asien-Pazifik (Sydney)](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (ap-southeast-2)
   + [Asien-Pazifik (Tokio)](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) (ap-northeast-1)
   + [Europa (Frankfurt) (eu-central-1)](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [Europa (Irland) (eu-west-1)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [Europa (London) (eu-west-2)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [Europa (Paris) (eu-west-3)](https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [Europa (Mailand) (eu-south-1)](https://console.aws.amazon.com/cloudformation/home?region=eu-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [Europa (Stockholm) (eu-north-1)](https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0)
   + [AWS GovCloud (US-Ost) (-1) us-gov-east](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml)
   + [AWS GovCloud (US-West) (us-gov-west-1)](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml)

1. **Geben Sie unter Geben Sie einen Stacknamen** an einen beschreibenden Namen ein. Dies ist der Name für Ihren CloudFormation Stack. Die Vorlage verwendet diesen Wert als Namen für Ihren AWS PCS-Cluster.

1. Unter **Parameter**:

   1. Wählen Sie unter **SlurmVersion**die Version von Slurm aus, die Ihr Cluster verwenden soll.

   1. Wählen Sie unter **x86** aus **NodeArchitecture**, um einen Cluster bereitzustellen, der x86\$164-kompatible Instances verwendet, oder wählen Sie **Graviton**, um Arm64-Instanzen zu verwenden.

   1. Wählen Sie für **KeyName**ein SSH-Schlüsselpaar für den Zugriff auf die Cluster-Login-Knoten. Vergewissern Sie sich, dass Sie die PEM-Datei für das von Ihnen gewählte key pair haben.

   1. Geben Sie für **ClientIpCidr**einen IP-Bereich im CIDR-Format ein, um den Zugriff auf die Anmeldeknoten zu steuern.
**Warnung**  
 Der Standardwert von `0.0.0.0/0` ermöglicht den Zugriff von allen IP-Adressen aus.

   1. Behalten Sie die Werte für **HpcRecipesS3Bucket** und **HpcRecipesBranch**als Standardwerte bei.

1. Unter **Funktionen und Transformationen**:

   1. Aktivieren Sie das Kontrollkästchen, um zu bestätigen, dass dadurch IAM-Ressourcen erstellt CloudFormation werden.

   1. Aktivieren Sie das Kontrollkästchen, um zu bestätigen, CloudFormation dass IAM-Ressourcen mit benutzerdefinierten Namen erstellt werden.

   1. Aktivieren Sie das Kontrollkästchen, um den neuen Stack zu bestätigen`CAPABILITY_AUTO_EXPAND`. Weitere Informationen finden Sie unter [CreateStack](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html#API_CreateStack_RequestParameters) in der *AWS CloudFormation -API-Referenz*.

1. Wählen Sie **Stack erstellen** aus.

1. Überwachen Sie den Status Ihres Stacks. Sie können eine Verbindung zum Cluster herstellen, wenn der Status des Stacks lautet`CREATE_COMPLETE`.

# Stellen Sie eine Connect zu einem AWS PCS-Cluster her, der erstellt wurde mit CloudFormation
<a name="get-started-cfn-connect"></a>

Nachdem Sie einen AWS PCS-Cluster anhand einer CloudFormation Vorlage erstellt haben, können Sie den Cluster mit der AWS PCS-Konsole (im AWS-Managementkonsole) verwalten. Sie können auch eine Verbindung zu einem der Anmeldeknoten des Clusters herstellen, um den Cluster zu verwalten, Jobs auszuführen und Daten zu verwalten. Der CloudFormation Stack bietet Links, über die Sie eine Verbindung zu Ihrem Cluster herstellen können.

**Um eine Verbindung zu Ihrem Cluster herzustellen**

1. Öffnen Sie die [CloudFormation -Konsole](https://console.aws.amazon.com/cloudformation).

1. Wählen Sie den Stack aus, den Sie erstellt haben.

1. Wählen Sie die Registerkarte **Ausgaben** des Stacks.

   Der Stapel bietet die folgenden Links:
   + **PcsConsoleUrl**— Wählen Sie diesen Link, um die AWS PCS-Konsole mit dem ausgewählten Cluster zu öffnen. Sie können ihn verwenden, um die Cluster-, Knotengruppen- und Warteschlangenkonfigurationen zu erkunden.
   + **Ec2 ConsoleUrl** — Wählen Sie diesen Link, um die Amazon EC2 EC2-Konsole zu öffnen, die so gefiltert ist, dass die Instances angezeigt werden, die von der Login-Knotengruppe des Clusters verwaltet werden.

     In dieser Ansicht können Sie eine Instanz auswählen und **Connect** wählen. Die Instanz des Beispielclusters unterstützt eingehendes SSH und AWS Systems Manager Verbindungen in einem Webbrowser. Weitere Informationen finden Sie unter [Connect zu Ihrem AWS PCS-Cluster her](getting-started_connect.md).

     Nachdem Sie eine Verbindung zu einer Anmeldeinstanz hergestellt haben, können Sie dem Tutorial unter folgen. [Erkunden Sie die Cluster-Umgebung in AWS PCS](getting-started_explore.md)

# Bereinigen Sie einen AWS PCS-Cluster in CloudFormation
<a name="get-started-cfn-cleanup"></a>

Wenn Sie früher CloudFormation Ihren AWS PCS-Cluster erstellt haben, können Sie die [CloudFormation Konsole](https://console.aws.amazon.com/cloudformation) öffnen und den Stack löschen, um den Cluster und alle zugehörigen Ressourcen zu löschen.

**Wichtig**  
Wenn Sie für den Beispielcluster zusätzliche Compute-Knotengruppen oder Warteschlangen in Ihrem Cluster erstellt haben (zusätzlich zu den `login` `compute-1` Gruppen, die mit der CloudFormation Beispielvorlage erstellt wurden), müssen Sie die [AWS PCS-Konsole](https://console.aws.amazon.com/pcs) verwenden oder AWS CLI diese Ressourcen löschen, bevor Sie den CloudFormation Stack löschen. Weitere Informationen finden Sie unter [Löschen eines Clusters in AWS PCS](working-with_clusters_delete.md).

# Teile einer CloudFormation Vorlage für AWS PCS
<a name="get-started-cfn-template-parts"></a>

Eine CloudFormation Vorlage besteht aus einem oder mehreren Abschnitten, die jeweils einem bestimmten Zweck dienen. CloudFormation definiert das Standardformat, die Syntax und die Standardsprache in einer Vorlage. Weitere Informationen finden Sie im *AWS CloudFormation Benutzerhandbuch* unter [Arbeiten mit CloudFormation Vorlagen](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html).

CloudFormation Vorlagen sind in hohem Maße anpassbar und daher können ihre Formate variieren. Um zu verstehen, welche Teile einer CloudFormation Vorlage zur Erstellung eines AWS PCS-Clusters erforderlich sind, empfehlen wir Ihnen, sich die Beispielvorlage anzusehen, die wir zur Erstellung eines Beispielclusters zur Verfügung stellen. In diesem Thema werden die Abschnitte dieser Beispielvorlage kurz erläutert.

**Wichtig**  
Die Codebeispiele in diesem Thema sind **nicht vollständig**. Das Vorhandensein von Auslassungspunkten (`[...]`) weist darauf hin, dass zusätzlicher Code nicht angezeigt wird. Informationen zum Herunterladen der vollständigen Vorlage im YAML-Format finden Sie unter. CloudFormation [CloudFormation Vorlagen zum Erstellen eines AWS PCS-Beispielclusters](get-started-cfn-sample-templates.md)

**Contents**
+ [Header](#get-started-cfn-template-parts-header)
+ [Metadaten](#get-started-cfn-template-parts-metadata)
+ [Parameters](#get-started-cfn-template-parts-parameters)
+ [Mappings](#get-started-cfn-template-parts-mappings)
+ [Ressourcen](#get-started-cfn-template-parts-resources)
+ [Outputs](#get-started-cfn-template-parts-outputs)

## Header
<a name="get-started-cfn-template-parts-header"></a>

```
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: AWS Parallel Computing Service "getting started" cluster
```

`AWSTemplateFormatVersion`identifiziert die Version im Vorlagenformat, der die Vorlage entspricht. Weitere Informationen finden Sie unter [Versionssyntax für das CloudFormation Vorlagenformat](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/format-version-structure.html) im *AWS CloudFormation Benutzerhandbuch*.

`Transform`gibt ein Makro an, das zur Verarbeitung der Vorlage CloudFormation verwendet wird. Weitere Informationen finden Sie im [Abschnitt Transformieren von CloudFormation Vorlagen](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html) im *AWS CloudFormation Benutzerhandbuch*. Die `AWS::Serverless-2016-10-31` Transformation ermöglicht CloudFormation die Verarbeitung einer Vorlage, die in der Syntax AWS Serverless Application Model (AWS SAM) geschrieben ist. Weitere Informationen finden Sie unter [`AWS::Serverless`Transform](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-aws-serverless.html) im *AWS CloudFormation Benutzerhandbuch*.

## Metadaten
<a name="get-started-cfn-template-parts-metadata"></a>

```
### Stack metadata
Metadata:
  AWS::CloudFormation::Interface:
    ParameterGroups:
      - Label:
          default: PCS Cluster configuration
        Parameters:
          - SlurmVersion
          - ManagedAccounting
          - AccountingPolicyEnforcement
      - Label:
          default: PCS ComputeNodeGroups configuration
        Parameters:
          - NodeArchitecture
          - KeyName
          - ClientIpCidr
      - Label:
          default: HPC Recipes configuration
        Parameters:
          - HpcRecipesS3Bucket
          - HpcRecipesBranch
```

Der `metadata` Abschnitt einer CloudFormation Vorlage enthält Informationen über die Vorlage selbst. Mit der Beispielvorlage wird ein vollständiger HPC-Cluster (High Performance Computing) erstellt, der AWS PCS verwendet. Im Metadatenbereich der Beispielvorlage werden Parameter deklariert, die steuern, wie der entsprechende CloudFormation Stack gestartet (bereitgestellt) wird. Es gibt Parameter, die die Architekturauswahl (`NodeArchitecture`), die Slurm-Version (`SlurmVersion`) und die Zugriffskontrollen (`KeyName`und`ClientIpCidr`) steuern.

## Parameters
<a name="get-started-cfn-template-parts-parameters"></a>

`Parameters`In diesem Abschnitt werden die benutzerdefinierten Parameter für die Vorlage definiert. CloudFormation verwendet diese Parameterdefinitionen, um das Formular zu erstellen und zu validieren, mit dem Sie interagieren, wenn Sie einen Stack von dieser Vorlage aus starten.

```
Parameters:

  NodeArchitecture:
    Type: String
    Default: x86
    AllowedValues:
      - x86
      - Graviton
    Description: Processor architecture for the login and compute node instances

  SlurmVersion:
    Type: String
    Default: 25.05
    Description: Version of Slurm to use
    AllowedValues:
         - 24.11
         - 25.05

  ManagedAccounting:
    Type: String
    Default: 'disabled'
    AllowedValues:
      - 'enabled'
      - 'disabled'
    Description: Monitor cluster usage, manage access control, and enforce resource limits with Slurm accounting. Requires Slurm 24.11 or newer.

  AccountingPolicyEnforcement:
    Description: Specify which Slurm accounting policies to enforce
    Type: String
    Default: none
    AllowedValues:
      - none
      - 'associations,limits,safe'

  KeyName:
    Description: SSH keypair to log in to the head node
    Type: AWS::EC2::KeyPair::KeyName
    AllowedPattern: ".+"  # Required

  ClientIpCidr:
    Description: IP(s) allowed to access the login node over SSH. We recommend that you restrict it with your own IP/subnet (x.x.x.x/32 for your own ip or x.x.x.x/24 for range. Replace x.x.x.x with your own PUBLIC IP. You can get your public IP using tools such as https://ifconfig.co/)
    Default: 127.0.0.1/32
    Type: String
    AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
    ConstraintDescription: Value must be a valid IP or network range of the form x.x.x.x/x. 

  HpcRecipesS3Bucket:
    Type: String
    Default: aws-hpc-recipes
    Description: HPC Recipes for AWS S3 bucket
    AllowedValues:
         - aws-hpc-recipes
         - aws-hpc-recipes-dev
  HpcRecipesBranch:
    Type: String
    Default: main
    Description: HPC Recipes for AWS release branch
    AllowedPattern: '^(?!.*/\.git$)(?!.*/\.)(?!.*\\.\.)[a-zA-Z0-9-_\.]+$'
```

## Mappings
<a name="get-started-cfn-template-parts-mappings"></a>

Der `Mappings` Abschnitt definiert Schlüssel-Wert-Paare, die Werte auf der Grundlage bestimmter Bedingungen oder Abhängigkeiten angeben.

```
Mappings:

  Architecture:
    AmiArchParameter:
      Graviton: arm64
      x86: x86_64
    LoginNodeInstances:
      Graviton: c7g.xlarge
      x86: c6i.xlarge
    ComputeNodeInstances:
      Graviton: c7g.xlarge
      x86: c6i.xlarge
```

## Ressourcen
<a name="get-started-cfn-template-parts-resources"></a>

`Resources`In diesem Abschnitt werden die AWS Ressourcen, die bereitgestellt und konfiguriert werden sollen, als Teil des Stacks deklariert.

```
Resources:

  [...]
```

Die Vorlage stellt die Beispiel-Cluster-Infrastruktur in Schichten bereit. Es beginnt mit `Networking` der VPC-Konfiguration. Der Speicher wird von zwei Systemen bereitgestellt: `EfsStorage` für gemeinsam genutzten Speicher und `FSxLStorage` für Hochleistungsspeicher. Der Core-Cluster wird durch eingerichtet`PCSCluster`.

```
  Networking:
    Type: AWS::CloudFormation::Stack
    Properties:
      Parameters:
        ProvisionSubnetsC: "False"
      TemplateURL: !Sub 'https://${HpcRecipesS3Bucket}.s3.amazonaws.com/${HpcRecipesBranch}/recipes/net/hpc_large_scale/assets/main.yaml'

  EfsStorage:
    Type: AWS::CloudFormation::Stack
    Properties:
      Parameters:
        SubnetIds: !GetAtt [ Networking, Outputs.DefaultPrivateSubnet ]
        SubnetCount: 1
        VpcId: !GetAtt [ Networking, Outputs.VPC ]
      TemplateURL: !Sub 'https://${HpcRecipesS3Bucket}.s3.amazonaws.com/${HpcRecipesBranch}/recipes/storage/efs_simple/assets/main.yaml'

  FSxLStorage:
    Type: AWS::CloudFormation::Stack
    Properties:
      Parameters:
        PerUnitStorageThroughput: 125
        SubnetId: !GetAtt [ Networking, Outputs.DefaultPrivateSubnet ]
        VpcId: !GetAtt [ Networking, Outputs.VPC ]
      TemplateURL: !Sub 'https://${HpcRecipesS3Bucket}.s3.amazonaws.com/${HpcRecipesBranch}/recipes/storage/fsx_lustre/assets/persistent.yaml'

  [...]
  
  # Cluster
  PCSCluster:
    Type: AWS::PCS::Cluster
    Properties:
      Name: !Sub '${AWS::StackName}'
      Size: SMALL
      Scheduler:
        Type: SLURM
        Version: !Ref SlurmVersion
      Networking:
        SubnetIds:
          - !GetAtt [ Networking, Outputs.DefaultPrivateSubnet ]
        SecurityGroupIds:
          - !GetAtt [ PCSSecurityGroup, Outputs.ClusterSecurityGroupId ]
```

Für Rechenressourcen erstellt die Vorlage zwei Knotengruppen: `PCSNodeGroupLogin` für einen einzelnen Anmeldeknoten und `PCSNodeGroupCompute` für bis zu vier Rechenknoten. Diese Knotengruppen werden von `PCSInstanceProfile` für Berechtigungen und beispielsweise `PCSLaunchTemplate` für Konfigurationen unterstützt. 

```
  # Compute Node groups
  PCSInstanceProfile:
    Type: AWS::CloudFormation::Stack
    Properties:
      Parameters:
        # We have to regionalize this in case CX use the template in more than one region. Otherwise,
        # the create action will fail since instance-role-${AWS::StackName} already exists!
        RoleName: !Sub '${AWS::StackName}-${AWS::Region}'
      TemplateURL: !Sub 'https://${HpcRecipesS3Bucket}.s3.amazonaws.com/${HpcRecipesBranch}/recipes/pcs/getting_started/assets/pcs-iip-minimal.yaml'

  PCSLaunchTemplate:
    Type: AWS::CloudFormation::Stack
    Properties:
      Parameters:
        VpcDefaultSecurityGroupId: !GetAtt [ Networking, Outputs.SecurityGroup ]
        ClusterSecurityGroupId: !GetAtt [ PCSSecurityGroup, Outputs.ClusterSecurityGroupId ]
        SshSecurityGroupId: !GetAtt [ PCSSecurityGroup, Outputs.InboundSshSecurityGroupId ]
        EfsFilesystemSecurityGroupId: !GetAtt [ EfsStorage, Outputs.SecurityGroupId ]
        FSxLustreFilesystemSecurityGroupId: !GetAtt [ FSxLStorage, Outputs.FSxLustreSecurityGroupId ]
        SshKeyName: !Ref KeyName
        EfsFilesystemId: !GetAtt [ EfsStorage, Outputs.EFSFilesystemId ]
        FSxLustreFilesystemId: !GetAtt [ FSxLStorage, Outputs.FSxLustreFilesystemId ]
        FSxLustreFilesystemMountName: !GetAtt [ FSxLStorage, Outputs.FSxLustreMountName ]
      TemplateURL: !Sub 'https://${HpcRecipesS3Bucket}.s3.amazonaws.com/${HpcRecipesBranch}/recipes/pcs/getting_started/assets/cfn-pcs-lt-efs-fsxl.yaml'

  # Compute Node groups - Login Nodes
  PCSNodeGroupLogin:
    Type: AWS::PCS::ComputeNodeGroup
    Properties:
      ClusterId: !GetAtt [PCSCluster, Id]
      Name: login
      ScalingConfiguration:
        MinInstanceCount: 1
        MaxInstanceCount: 1
      IamInstanceProfileArn: !GetAtt [ PCSInstanceProfile, Outputs.InstanceProfileArn ]
      CustomLaunchTemplate:
        TemplateId: !GetAtt [ PCSLaunchTemplate, Outputs.LoginLaunchTemplateId ]
        Version: 1
      SubnetIds:
        - !GetAtt [ Networking, Outputs.DefaultPublicSubnet ]
      AmiId: !GetAtt [PcsSampleAmi, AmiId]
      InstanceConfigs:
        - InstanceType: !FindInMap [ Architecture, LoginNodeInstances, !Ref NodeArchitecture ]

  # Compute Node groups - Compute Nodes
  PCSNodeGroupCompute:
    Type: AWS::PCS::ComputeNodeGroup
    Properties:
      ClusterId: !GetAtt [PCSCluster, Id]
      Name: compute-1
      ScalingConfiguration:
        MinInstanceCount: 0
        MaxInstanceCount: 4
      IamInstanceProfileArn: !GetAtt [ PCSInstanceProfile, Outputs.InstanceProfileArn ]
      CustomLaunchTemplate:
        TemplateId: !GetAtt [ PCSLaunchTemplate, Outputs.ComputeLaunchTemplateId ]
        Version: 1
      SubnetIds:
        - !GetAtt [ Networking, Outputs.DefaultPrivateSubnet ]
      AmiId: !GetAtt [PcsSampleAmi, AmiId]
      InstanceConfigs:
        - InstanceType: !FindInMap [ Architecture, ComputeNodeInstances, !Ref NodeArchitecture ]
```

Job Arbeitsplanung erfolgt über`PCSQueueCompute`.

```
  PCSQueueCompute:
    Type: AWS::PCS::Queue
    Properties:
      ClusterId: !GetAtt [PCSCluster, Id]
      Name: demo
      ComputeNodeGroupConfigurations:
        - ComputeNodeGroupId: !GetAtt [PCSNodeGroupCompute, Id]
```

Die AMI-Auswahl erfolgt automatisch über die Pcs AMILookup Fn Lambda-Funktion und zugehörige Ressourcen.

```
        
  PcsAMILookupRole:
    Type: AWS::IAM::Role
    [...]
    
  PcsAMILookupFn:
    Type: AWS::Lambda::Function
    Properties:
      Runtime: python3.12
      Handler: index.handler
      Role: !GetAtt PcsAMILookupRole.Arn
      Code:
        [...]
      Timeout: 30
      MemorySize: 128

  # Example of using the custom resource to look up an AMI
  PcsSampleAmi:
    Type: Custom::AMILookup
    Properties:
      ServiceToken: !GetAtt PcsAMILookupFn.Arn
      OperatingSystem: 'amzn2'
      Architecture: !FindInMap [ Architecture, AmiArchParameter, !Ref NodeArchitecture ]
      SlurmVersion: !Ref SlurmVersion
```

## Outputs
<a name="get-started-cfn-template-parts-outputs"></a>

Die Vorlage gibt die Clusteridentifikation und -verwaltung URLs über `ClusterId``PcsConsoleUrl`, und `Ec2ConsoleUrl` aus.

```
Outputs:
  ClusterId:
    Description: The Id of the PCS cluster
    Value: !GetAtt [ PCSCluster, Id ]
    
  PcsConsoleUrl:
    Description: URL to access the cluster in the PCS console
    Value: !Sub
      - https://${ConsoleDomain}/pcs/home?region=${AWS::Region}#/clusters/${ClusterId}
      - { ConsoleDomain: !If [ GovCloud, 'console.amazonaws-us-gov.com', !If [ China, 'console.amazonaws.cn', !Sub '${AWS::Region}.console.aws.amazon.com']],
          ClusterId: !GetAtt [ PCSCluster, Id ] 
        }
    Export:
      Name: !Sub ${AWS::StackName}-PcsConsoleUrl
      
  Ec2ConsoleUrl:
    Description: URL to access instance(s) in the login node group via Session Manager
    Value: !Sub
      - https://${ConsoleDomain}/ec2/home?region=${AWS::Region}#Instances:instanceState=running;tag:aws:pcs:compute-node-group-id=${NodeGroupLoginId}
      - { ConsoleDomain: !If [ GovCloud, 'console.amazonaws-us-gov.com', !If [ China, 'console.amazonaws.cn', !Sub '${AWS::Region}.console.aws.amazon.com']],
          NodeGroupLoginId: !GetAtt [ PCSNodeGroupLogin, Id ] 
        }
    Export:
      Name: !Sub ${AWS::StackName}-Ec2ConsoleUrl
```

# CloudFormation Vorlagen zum Erstellen eines AWS PCS-Beispielclusters
<a name="get-started-cfn-sample-templates"></a>


****  

| AWS-Region Name | AWS-Region | Quelle ansehen | Stack starten | 
| --- | --- | --- | --- | 
| USA Ost (Nord-Virginia) | us-east-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| USA Ost (Ohio) | us-east-2 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| USA West (Oregon) | us-west-2 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Asien-Pazifik (Mumbai) | ap-south-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Asien-Pazifik (Singapur) | ap-southeast-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Asien-Pazifik (Sydney) | ap-southeast-2 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Asien-Pazifik (Tokio) | ap-northeast-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (Frankfurt) | eu-central-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (Irland) | eu-west-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (London) | eu-west-2 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-west-2#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (Paris) | eu-west-3 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-west-3#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (Milan) | eu-south-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-south-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| Europa (Stockholm) | eu-north-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0](https://console.aws.amazon.com/cloudformation/home?region=eu-north-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml&param_ClientIpCidr=0.0.0.0%2F0) | 
| AWS GovCloud (US-Ost) | us-gov-east-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-east-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | 
| AWS GovCloud (US-West) | us-gov-west-1 | [Laden Sie YAML herunter](https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | [https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml](https://console.amazonaws-us-gov.com/cloudformation/home?region=us-gov-west-1#/stacks/create/review?stackName=get-started-cfn&templateURL=https://s3.amazonaws.com/aws-hpc-recipes/main/recipes/pcs/getting_started/assets/cluster.yaml) | 