You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

  1. import time
  2. import boto3
  3. from botocore.exceptions import ClientError
  4. region = 'eu-central-1'
  5. stackName = 'cloudcomp-counter-demo-stack'
  6. keyName = 'srieger-pub'
  7. client = boto3.setup_default_session(region_name=region)
  8. cfClient = boto3.client('cloudformation')
  9. templateFile = open("cloudcomp-counter-demo.json", "r")
  10. templateBody = templateFile.read()
  11. print("Deleting old stack...")
  12. print("------------------------------------")
  13. response = cfClient.delete_stack(
  14. StackName=stackName,
  15. )
  16. print("creating new stack...")
  17. print("------------------------------------")
  18. response = cfClient.create_stack(
  19. StackName=stackName,
  20. TemplateBody=templateBody,
  21. Parameters=[
  22. {
  23. 'ParameterKey': 'paramKeyPair',
  24. 'ParameterValue': keyName
  25. },
  26. {
  27. 'ParameterKey': 'paramVPC',
  28. 'ParameterValue': 'vpc-eedd4187'
  29. },
  30. {
  31. 'ParameterKey': 'paramAvailabilityZones',
  32. 'ParameterValue': 'eu-central-1a, eu-central-1b, eu-central-1c',
  33. },
  34. {
  35. 'ParameterKey': 'paramSubnetIDs',
  36. 'ParameterValue': 'subnet-5c5f6d16, subnet-41422b28, subnet-6f2ea214',
  37. },
  38. ],
  39. )