I've create a python troposphere script that's been working quite well overall. I just added in a new piece of code to add a policy to the autoscaling group for an alarm.
The code looks like:
tintScaleDown = autoscaling.ScalingPolicy("tintScaleDown1")
tintScaleDown.AdjustmentType = "ChangeInCapacity"
tintScaleDown.AutoScalingGroupName(Ref("tintASG"))
tintScaleDown.Cooldown = "900"
tintScaleDown.ScalingAdjustment = "1"
t.add_resource(tintScaleDown)
The error is:
Traceback (most recent call last): File "inPowered.py", line 395, in tintScaleDown.AutoScalingGroupName(Ref("tintASG")) File "/usr/lib/python2.7/site-packages/troposphere/init.py", line 79, in getattr raise AttributeError(name)
The Reference should have been established in this line:
asg = autoscaling.AutoScalingGroup("tintASG")
The section of the CloudFormation script should look like:
"tintScaleDown1": {
"Type": "AWS::AutoScaling::ScalingPolicy",
"Properties": {
"AdjustmentType": "ChangeInCapacity",
"AutoScalingGroupName": {
"Ref": "tintASG"
},
"Cooldown": "900",
"ScalingAdjustment": "-1"
}
},
Suggestions?