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.

35 lines
801 B

  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-with-vpc.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. )