Menu
AWS for DevOps
Getting Started Guide

Step 7.2: Create and Run the Pipeline for AWS Elastic Beanstalk

In this step, you will create a pipeline in AWS CodePipeline to automate the deployment of the source code in AWS CodeCommit to your deployment target in Elastic Beanstalk. After you create the pipeline, AWS CodePipeline will immediately start the deployment.

If you want to create a pipeline for AWS CodeDeploy, go to Step 7.1: AWS CodeDeploy Pipeline.

If you want to create a pipeline for AWS OpsWorks, go to Step 7.3: AWS OpsWorks Pipeline.

The following procedure uses an AWS CloudFormation template to create a pipeline in AWS CodePipeline. (To view the contents of the AWS CloudFormation template, see ElasticBeanstalkPipelineSetup.template.) To learn how to create the pipeline in other ways, such as with the AWS Management Console or the AWS Command Line Interface (AWS CLI), see the following topics in the AWS CodePipeline User Guide:

To create and run the pipeline for Elastic Beanstalk

  1. Use the AWS CloudFormation console to create a stack in the US East (N. Virginia) region based on the following Amazon S3 template URL: https://s3.amazonaws.com/aws-for-devops/cfn-templates/ElasticBeanstalkPipelineSetup.template

    On the Specify Details page, the settings in the Parameters area are used to:

    • Create a pipeline in AWS CodePipeline, specifying the AWS CodeCommit repository and branch to deploy from and the Elastic Beanstalk application and environment to deploy to.

    • Create an Amazon S3 bucket used by AWS CodePipeline to store and manage the files to be deployed, apply to the bucket an Amazon S3 bucket policy that allows AWS CodePipeline to access the bucket, and associate the bucket with the pipeline.

    • Create an AWS CodePipeline service role for the pipeline to use to interact with dependent AWS services, and associate the service role with the pipeline.

    To accept these default settings, type a unique bucket name for ArtifactBucketName, and then go to step 2 of this procedure.

    Alternatively, you may want to experiment with these default settings by running this template multiple times to create AWS CodePipeline, Amazon S3, and IAM resources for this walkthrough. For example, later on you may want to create more pipelines for use with Elastic Beanstalk and associate them with an existing bucket and service role.

    The following table shows which settings to choose in the Parameters area.

    I want to create an Amazon S3 bucket that will be used by the pipeline to store and manage the files to be deployed.

    Leave ArtifactBucket set to the default value of New. For ArtifactBucketName, type the name of the new bucket.

    Note

    Set ArtifactBucket to Existing if you already have a bucket you want the pipeline to use. For ArtifactBucketName, type the name of the bucket.

    If you use an existing bucket, the bucket must have versioning enabled and a specific bucket policy attached. For more information, see Create a Policy for an Amazon S3 Bucket to Use as the Artifact Store for AWS CodePipeline in the AWS CodePipeline User Guide.

    I want to create an AWS CodePipeline service role for the pipeline to use to interact with dependent AWS services.

    Leave ServiceRole set to the default value of New.

    Note

    Set ServiceRole to Existing if you already have an AWS CodePipeline service role you want the pipeline to use. For ServiceRoleARN, type the Amazon Resource Name (ARN) of the service role. The service role must be compatible with AWS CodePipeline. For more information, see Edit a Policy for an IAM Service Role in the AWS CodePipeline User Guide.

  2. When CREATE_COMPLETE is displayed for Status for the stack, open the AWS CodePipeline console at https://console.aws.amazon.com/codepipeline/.

  3. In the AWS region selector, choose US East (N. Virginia).

  4. On the All Pipelines page, choose the new pipeline.

  5. When Succeeded is displayed for the Source and Deploy stages, go to Step 8.2: Verify Elastic Beanstalk Results.