The following code is based off of the boto3 / API documentation, it prints what should be deleted but doesn't delete the Hybrid activation, nor does it create an error. Can you help me determine why the activations aren't being deleted.
import boto3
client = boto3.client('ssm')
response = client.describe_activations(
Filters=[
{
'FilterKey': 'IamRole',
'FilterValues': [
'MySSMServiceRole'
]
}
]
)
print('\n These Hybrid Activations were deleted:')
for x in response['ActivationList']:
a = x['ActivationId']
b = x['Description'][0:3]
c = x['Expired']
if c == 'True':
delete_activation(
{
'ActivationList': a
}
)
print(' {} {} {}'.format(a, b, c))
I originally was using this in attempts to to delete the expired activations but was getting the same result.
response = client.delete_activation(
ActivationId = a
)
I changed the if statement to use the c variable and it worked. The original if statement was comparing a string to boolean, and why it didn't work.