Reorganization of VMWonAWS Script Resources

Reorganizing VMWonAWS scripting resources into the appropriate folder.
This commit is contained in:
Kyle Ruddy
2018-06-13 16:04:54 -04:00
parent 2c23ecb414
commit 0a1e5a65c3
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
#List the commands available for the VMC module
Get-VMCCommand
#Connect to VMC
$MyRefreshToken = "XXXX-XXXX-XXXX-XXXX"
Connect-VMC -RefreshToken $MyRefreshToken
#List the Orgs available to us
Get-VMCOrg
#List the SDDCs
Get-VMCSDDC -Org BashFest*
#List the Tasks for a particular Org
Get-VMCTask -Org BashFest* | Select-Object task_type, Sub_Status, start_time, End_time, user_name | Sort-Object Start_Time | Format-Table
#Get the Public IPs for a SDDC
Get-VMCSDDCPublicIPPool -org bashfest*
#Get all ESXi hosts for given SDDC
Get-VMCVMHost -org bashfest* -Sddc virtu-al
#Get the credentials of a SDDC so we can login via vSphere cmdlets
Get-VMCSDDCDefaultCredential -org bashfest* -Sddc virtu-al
#Connect to your VMC vCenter with default creds
Connect-VmcVIServer -org bashfest* -Sddc virtu-al
#Run some vSphere cmdlets
#List all VMs from On-Premises and VMC SDDC
Get-VM | Select vCenterServer, Name, PowerState, VMHost

View File

@@ -0,0 +1,51 @@
# Author: Kyle Ruddy
# Product: VMware Cloud on AWS
# Description: VMware Cloud on AWS Single Host Deployment Script using PowerCLI
# Requirements:
# - PowerShell 3.x or newer
# - PowerCLI 6.5.4 or newer
# Set details for SDDC
$oauthToken = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
$sddcName = "PowerCLI-1Node-SDDC"
$hostCount = "1"
$awsRegion = "US_WEST_2"
# --- Deployment code ---
# Connect to VMware Cloud Service
Connect-Vmc -RefreshToken $oauthToken | Out-Null
# Get ORG ID
$orgSvc = Get-VmcService -Name com.vmware.vmc.orgs
$org = $orgSvc.List()
Write-Host "Org:"$org.display_name" ID:"$org.id
# Get Linked Account ID
$connAcctSvc = Get-VmcService -Name com.vmware.vmc.orgs.account_link.connected_accounts
$connAcctId = $connAcctSvc.get($org.id) | Select-Object -ExpandProperty id
Write-Host "Account ID: $connAcctId"
# Get Subnet ID
$compSubnetSvc = Get-VmcService -Name com.vmware.vmc.orgs.account_link.compatible_subnets
$vpcMap = $compSubnetSvc.Get($org.id, $connAcctId, $region) | Select-Object -ExpandProperty vpc_map
$compSubnets = $vpcMap | Select-Object -ExpandProperty Values | Select-Object -ExpandProperty subnets
$compSubnet = $compSubnets | where {$_.name -ne $null} | Select-Object -first 1
Write-Host "Subnet CIDR"$compSubnet.subnet_cidr_block"ID:"$compSubnet.subnet_id
# Deploy the SDDC
$sddcSvc = Get-VmcService com.vmware.vmc.orgs.sddcs
$sddcCreateSpec = $sddcSvc.Help.create.sddc_config.Create()
$sddcCreateSpec.region = $awsRegion
$sddcCreateSpec.Name = $sddcName
$sddcCreateSpec.num_hosts = $hostCount
if ($org.properties.values.sddcTypes) {$sddcCreateSpec.sddc_type = "1NODE"}
$sddcCreateSpec.Provider = "AWS"
$accountLinkSpec = $sddcSvc.Help.create.sddc_config.account_link_sddc_config.Element.Create()
$accountLinkSpec.connected_account_id = $connAcctId
$custSubId0 = $sddcSvc.Help.create.sddc_config.account_link_sddc_config.Element.customer_subnet_ids.Element.Create()
$custSubId0 = $compSubnet.subnet_id
$accountLinkSpec.customer_subnet_ids.Add($custSubId0) | Out-Null
$sddcCreateSpec.account_link_sddc_config.Add($accountLinkSpec) | Out-Null
$sddcCreateSpec
$newSddc = $sddcSvc.create($org.Id, $sddcCreateSpec)
$newSddc