OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 import time |
| 3 import json |
| 4 |
| 5 from tests.unit import unittest |
| 6 from boto.cloudformation.connection import CloudFormationConnection |
| 7 |
| 8 |
| 9 BASIC_EC2_TEMPLATE = { |
| 10 "AWSTemplateFormatVersion": "2010-09-09", |
| 11 "Description": "AWS CloudFormation Sample Template EC2InstanceSample", |
| 12 "Parameters": { |
| 13 }, |
| 14 "Mappings": { |
| 15 "RegionMap": { |
| 16 "us-east-1": { |
| 17 "AMI": "ami-7f418316" |
| 18 } |
| 19 } |
| 20 }, |
| 21 "Resources": { |
| 22 "Ec2Instance": { |
| 23 "Type": "AWS::EC2::Instance", |
| 24 "Properties": { |
| 25 "ImageId": { |
| 26 "Fn::FindInMap": [ |
| 27 "RegionMap", |
| 28 { |
| 29 "Ref": "AWS::Region" |
| 30 }, |
| 31 "AMI" |
| 32 ] |
| 33 }, |
| 34 "UserData": { |
| 35 "Fn::Base64": "a" * 15000 |
| 36 } |
| 37 } |
| 38 } |
| 39 }, |
| 40 "Outputs": { |
| 41 "InstanceId": { |
| 42 "Description": "InstanceId of the newly created EC2 instance", |
| 43 "Value": { |
| 44 "Ref": "Ec2Instance" |
| 45 } |
| 46 }, |
| 47 "AZ": { |
| 48 "Description": "Availability Zone of the newly created EC2 instance"
, |
| 49 "Value": { |
| 50 "Fn::GetAtt": [ |
| 51 "Ec2Instance", |
| 52 "AvailabilityZone" |
| 53 ] |
| 54 } |
| 55 }, |
| 56 "PublicIP": { |
| 57 "Description": "Public IP address of the newly created EC2 instance"
, |
| 58 "Value": { |
| 59 "Fn::GetAtt": [ |
| 60 "Ec2Instance", |
| 61 "PublicIp" |
| 62 ] |
| 63 } |
| 64 }, |
| 65 "PrivateIP": { |
| 66 "Description": "Private IP address of the newly created EC2 instance
", |
| 67 "Value": { |
| 68 "Fn::GetAtt": [ |
| 69 "Ec2Instance", |
| 70 "PrivateIp" |
| 71 ] |
| 72 } |
| 73 }, |
| 74 "PublicDNS": { |
| 75 "Description": "Public DNSName of the newly created EC2 instance", |
| 76 "Value": { |
| 77 "Fn::GetAtt": [ |
| 78 "Ec2Instance", |
| 79 "PublicDnsName" |
| 80 ] |
| 81 } |
| 82 }, |
| 83 "PrivateDNS": { |
| 84 "Description": "Private DNSName of the newly created EC2 instance", |
| 85 "Value": { |
| 86 "Fn::GetAtt": [ |
| 87 "Ec2Instance", |
| 88 "PrivateDnsName" |
| 89 ] |
| 90 } |
| 91 } |
| 92 } |
| 93 } |
| 94 |
| 95 |
| 96 class TestCloudformationConnection(unittest.TestCase): |
| 97 def setUp(self): |
| 98 self.connection = CloudFormationConnection() |
| 99 self.stack_name = 'testcfnstack' + str(int(time.time())) |
| 100 |
| 101 def test_large_template_stack_size(self): |
| 102 # See https://github.com/boto/boto/issues/1037 |
| 103 body = self.connection.create_stack( |
| 104 self.stack_name, |
| 105 template_body=json.dumps(BASIC_EC2_TEMPLATE)) |
| 106 self.addCleanup(self.connection.delete_stack, self.stack_name) |
| 107 |
| 108 |
| 109 if __name__ == '__main__': |
| 110 unittest.main() |
OLD | NEW |