Pool Args
Manages an Azure Batch pool.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.batch.Account;
import com.pulumi.azure.batch.AccountArgs;
import com.pulumi.azure.batch.Certificate;
import com.pulumi.azure.batch.CertificateArgs;
import com.pulumi.azure.batch.Pool;
import com.pulumi.azure.batch.PoolArgs;
import com.pulumi.azure.batch.inputs.PoolAutoScaleArgs;
import com.pulumi.azure.batch.inputs.PoolStorageImageReferenceArgs;
import com.pulumi.azure.batch.inputs.PoolContainerConfigurationArgs;
import com.pulumi.azure.batch.inputs.PoolStartTaskArgs;
import com.pulumi.azure.batch.inputs.PoolStartTaskUserIdentityArgs;
import com.pulumi.azure.batch.inputs.PoolStartTaskUserIdentityAutoUserArgs;
import com.pulumi.azure.batch.inputs.PoolCertificateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var exampleBatch_accountAccount = new Account("exampleBatch/accountAccount", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.poolAllocationMode("BatchService")
.storageAccountId(exampleAccount.id())
.storageAccountAuthenticationMode("StorageKeys")
.tags(Map.of("env", "test"))
.build());
var exampleCertificate = new Certificate("exampleCertificate", CertificateArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.accountName(exampleBatch / accountAccount.name())
.certificate(Base64.getEncoder().encodeToString(Files.readAllBytes(Paths.get("certificate.cer"))))
.format("Cer")
.thumbprint("312d31a79fa0cef49c00f769afc2b73e9f4edf34")
.thumbprintAlgorithm("SHA1")
.build());
var examplePool = new Pool("examplePool", PoolArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.accountName(exampleBatch / accountAccount.name())
.displayName("Test Acc Pool Auto")
.vmSize("Standard_A1")
.nodeAgentSkuId("batch.node.ubuntu 20.04")
.autoScale(PoolAutoScaleArgs.builder()
.evaluationInterval("PT15M")
.formula("""
startingNumberOfVMs = 1;
maxNumberofVMs = 25;
pendingTaskSamplePercent = $PendingTasks.GetSamplePercent(180 * TimeInterval_Second);
pendingTaskSamples = pendingTaskSamplePercent < 70 ? startingNumberOfVMs : avg($PendingTasks.GetSample(180 * TimeInterval_Second));
$TargetDedicatedNodes=min(maxNumberofVMs, pendingTaskSamples);
""")
.build())
.storageImageReference(PoolStorageImageReferenceArgs.builder()
.publisher("microsoft-azure-batch")
.offer("ubuntu-server-container")
.sku("20-04-lts")
.version("latest")
.build())
.containerConfiguration(PoolContainerConfigurationArgs.builder()
.type("DockerCompatible")
.containerRegistries(PoolContainerConfigurationContainerRegistryArgs.builder()
.registryServer("docker.io")
.userName("login")
.password("apassword")
.build())
.build())
.startTask(PoolStartTaskArgs.builder()
.commandLine("echo 'Hello World from $env'")
.taskRetryMaximum(1)
.waitForSuccess(true)
.commonEnvironmentProperties(Map.of("env", "TEST"))
.userIdentity(PoolStartTaskUserIdentityArgs.builder()
.autoUser(PoolStartTaskUserIdentityAutoUserArgs.builder()
.elevationLevel("NonAdmin")
.scope("Task")
.build())
.build())
.build())
.certificates(PoolCertificateArgs.builder()
.id(exampleCertificate.id())
.storeLocation("CurrentUser")
.visibilities("StartTask")
.build())
.build());
}
}
Import
Batch Pools can be imported using the resource id
, e.g.
$ pulumi import azure:batch/pool:Pool example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup1/providers/Microsoft.Batch/batchAccounts/myBatchAccount1/pools/myBatchPool1
Constructors
Functions
Properties
Whether the pool permits direct communication between nodes. This imposes restrictions on which nodes can be assigned to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not specified, this value defaults to Disabled
. Values allowed are Disabled
and Enabled
.
The type of on-premises license to be used when deploying the operating system. This only applies to images that contain the Windows operating system, and should only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no on-premises licensing discount is applied. Values are: "Windows_Server" - The on-premises license is for Windows Server. "Windows_Client" - The on-premises license is for Windows Client.
Specifies the ephemeral disk placement for operating system disk for all VMs in the pool. This property can be used by user in the request to choose which location the operating system should be in. e.g., cache disk space for Ephemeral OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer to Ephemeral OS disk size requirements for Windows VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VMs at https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements. The only possible value is CacheDisk
.