PowerShell script exchange
Post Reply
exarchbcn
Influencer
Posts: 10
Liked: 4 times
Joined: Sep 27, 2022 8:21 am
Full Name: LVB
Contact:

Getting info from S3 Repositories and capacity layers on scaleouts

Post by exarchbcn »

Hello,

I'm working with a big Veeam infrastructure and I want to get information on all the S3 buckets (standalone buckets and buckets that are capacity layers within scaleout repositories) within the infrastructure.

One of the main thing I'm looking for is the AWS region where those buckets are located, the bucket name, folder name and their size.

Standalone S3 Repositories

I can find Region, bucket and folder using Get-VBRObjectStorageRepository, but I didn't find where I can find the size used in the bucket.

Sample code here:

Code: Select all

    $repositories = Get-VBRBackupRepository

    foreach ($repo in $repositories) {
            if ($repo.TypeDisplay -eq "Amazon S3") {
                
                $ObjectStorageRepoProperties = Get-VBRObjectStorageRepository -id $repo.ID

                $Repoinfo = $repo.Info
                $AmazonOptions = $repo.AmazonOptions
                Write-Host "AWS Region: $($AmazonOptions.RegionId)"
                Write-Host "AWS Bucket Name: $($AmazonOptions.BucketName)"
                Write-Host "Bucket folder name: $($AmazonOptions.FolderName)"
            }
        }

How I can get the used size?

Scale Out Repositories

In this case, I can't even find the previous data available for standalone S3 buckets. I show the sample code below I'm using below:

Code: Select all

    $scaleOutRepos = Get-VBRBackupRepository -ScaleOut
    foreach ($scaleOutRepo in $scaleOutRepos) {
        $CapacityLayer = Get-VBRrepositoryExtent -repository $scaleoutrepo.Name
        $capacityBucket = Get-VBRObjectStorageRepository -Id $CapacityLayer.Id
        }
    }
The properties available in this case are not the same as when it's standalone, and I can't see the same information. See below the output of Get-VBRObjectStorageRepository on one of the buckets attached as capacity layer to the scale-out:

PS C:> Get-VBRObjectStorageRepository -name lab-s3bucket

AmazonS3Folder : Lab-Backup
EnableIAStorageClass : False
EnableOZIAStorageClass : False
BackupImmutabilityEnabled : True
ImmutabilityPeriod : 14
MountServerOptions : Veeam.Backup.PowerShell.Infos.VBRRepositoryMountServerOptions
Type : AmazonS3
GatewayServer : {gateway.mydomain.com(5b291ada-e588-411d-9af6-a84eef50c685)}
ConnectionType : Gateway
SizeLimitEnabled : False
SizeLimit : 10240
ConcurrentTasksLimitEnabled : False
MaxConcurrentTasksCount : -1
Id : 3730886c-b114-4c19-ac0c-1b8955420920
Name : Lab-S3Bucket
Description : S3 Bucket used for LAB and Testing


What I'm doing wrong? how I can get the region info for the S3 bucket attached as capacity extent in the scaleout repository? And how I can get the size as well?

If anyone can help it will be highly appreciated.

Thanks in advance and best regards!
david.domask
Veeam Software
Posts: 2863
Liked: 657 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Getting info from S3 Repositories and capacity layers on scaleouts

Post by david.domask » 1 person likes this post

Hi exarchbcn,

For Capacity (and Archive) extents, you need to first retrieve the Scale-out Backup Repository and then retrieve the Capacity and Archive tier extents from their respective properties.

Quick example code:

Code: Select all

$repo = Get-VBRBackupRepository -ScaleOut -Name 'SOBR-AWS'
$cap = $repo.CapacityExtent
$cap.Repository.AmazonS3Folder.Bucket

Region       Name
------       ----
eu-central-1 hk-vbr-02-fk-capacitytier

$repo2 = Get-VBRBackupRepository -ScaleOut -Name "*spectra*"
$repo2.ArchiveExtent.Repository.AmazonS3Folder.Bucket

Region    Name
------    ----
us-east-1 ddbucket
As for Used size and other space items, unfortunately we must use unsupported methods at this time. Try the code snippets Oleg suggests in that thread and it should work.
David Domask | Product Management: Principal Analyst
exarchbcn
Influencer
Posts: 10
Liked: 4 times
Joined: Sep 27, 2022 8:21 am
Full Name: LVB
Contact:

Re: Getting info from S3 Repositories and capacity layers on scaleouts

Post by exarchbcn »

Thanks David for the prompt response.

For the Region topic with the capacity extent, is now solved, thanks!

Regarding the size, I tried the methods mentioned by Oleg but both fail:

PS C:\Users> $repo = Get-VBRObjectStorageRepository -Type AmazonS3
PS C:\Users> [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo[0].Id)
Method invocation failed because [Veeam.Backup.Core.CBackupRepository] does not contain a method named 'CalcArchiveRepositoryUsedSizeByIndices'.
At line:1 char:1
+ [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeB ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

PS C:\Users> $repo = Get-VBRObjectStorageRepository -Type AmazonS3 -Name "Lab-S3Bucket"
PS C:\Users> [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeByIndices($repo.Id)
Method invocation failed because [Veeam.Backup.Core.CBackupRepository] does not contain a method named 'CalcArchiveRepositoryUsedSizeByIndices'.
At line:1 char:1
+ [Veeam.Backup.Core.CBackupRepository]::CalcArchiveRepositoryUsedSizeB ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
david.domask
Veeam Software
Posts: 2863
Liked: 657 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Getting info from S3 Repositories and capacity layers on scaleouts

Post by david.domask » 1 person likes this post

Hi exarchbcn, you're very welcome.

Regarding used size, I apparently need to update my bookmarks as looks like that method was removed.

Try the method from this thread, I was able to get it to work on v12.3.1 (current as of this writing)

powershell-f26/get-backup-repository-st ... ml#p489708

Code: Select all

$repo = Get-VBRObjectStorageRepository -Type Wasabi -Name 'wasabi.cloud'
[Veeam.Backup.Core.CArchiveRepository]::GetTotalUsedSize($repo.Id)
The same class has the original method as well:

[Veeam.Backup.Core.CArchiveREpository]::GetUsedSizeByIndices() #pass the repository ID as the argument like in the example above
David Domask | Product Management: Principal Analyst
exarchbcn
Influencer
Posts: 10
Liked: 4 times
Joined: Sep 27, 2022 8:21 am
Full Name: LVB
Contact:

Re: Getting info from S3 Repositories and capacity layers on scaleouts

Post by exarchbcn » 1 person likes this post

Thanks!!!

This one worked fine!
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests