Using GitHub Actions to deploy to Elastic Beanstalk
GitHub Actions
Example workflow
The following example workflow deploys an application to an Elastic Beanstalk environment
each time you push to the main branch. Create a .yml file in your repository under
.github/workflows/ .
Example GitHub Actions workflow for Elastic Beanstalk deployment
name: Deploy to Elastic Beanstalk on: push: branches: - main permissions: id-token: write contents: read jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::123456789012:role/my-github-actions-roleaws-region:us-east-1- name: Deploy to Elastic Beanstalk uses: aws-actions/aws-elasticbeanstalk-deploy@v1.0.0 with: aws-region:us-east-1application-name:my-applicationenvironment-name:my-application-env
This workflow checks out your repository, uses OpenID Connect (OIDC)
For more configuration options and advanced examples, see the Elastic Beanstalk
Deploy action README
Additional resources
-
Elastic Beanstalk Deploy action
on GitHub -
Configure AWS Credentials action
on GitHub -
Configuring OpenID Connect in Amazon Web Services
(GitHub documentation)