Launching the stack and configuring Jenkins

In order to create our EC2 instance with Jenkins running on it, we will proceed as we did in Chapter 3, Treating Your Infrastructure as Code, using either the web interface or the command-line interface as follows:

$ aws cloudformation create-stack \
      --capabilities CAPABILITY_IAM \
      --stack-name jenkins \
      --template-body file://jenkins-cf.template \
      --parameters        ParameterKey=KeyPair,ParameterValue=EffectiveDevOpsAWS  

As we did before, we can then wait until the execution is complete:

$ aws cloudformation wait stack-create-complete \
      --stack-name jenkins  

After that, we can extract the host's public IP:

$ aws cloudformation describe-stacks \
      --stack-name jenkins \
      --query 'Stacks[0].Outputs[0]' ...

Get Effective DevOps with AWS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.