Mar-13-2023, 11:59 PM
(This post was last modified: Mar-14-2023, 11:00 AM by snippsat.
Edit Reason: Fix code tag
)
Need help. trying to set below parameters with code listed below but throwing error. can you help me what is the correct syntax for condition listed below for EBS volume size. thank you
CODE
------
Output:Disk Size in GB IOPS Throughput(MBps)
< 250 3000 125
>250 to <1TB 3000 250
============================CODE
------
for volume in volumes: VolumeId = volume['VolumeId'] VolumeType = volume['VolumeType'] Size = volume['Size'] IOP = volume['Iops'] try: if VolumeType == 'gp2' or VolumeType == 'io1' and VolumeSize<=250: modify = client.modify_volume(VolumeId=VolumeId,VolumeType='gp3',IOPS='3000','Throughput=125',DryRun=DryRun) print(f"{VolumeId} changed to gp3") else: print(f"{VolumeId} does not fit criteria") except botocore.exceptions.ClientError as error: print(error) if VolumeType == 'gp2' or VolumeType == 'io1' and VolumeSize>=250 and =<1000: modify = client.modify_volume(VolumeId=VolumeId,VolumeType='gp3',IOPS='3000','Throughput=250',DryRun=DryRun) print(f"{VolumeId} changed to gp3") else: print(f"{VolumeId} does not fit criteria") except botocore.exceptions.ClientError as error: print(error)