Skip to content

josemando/aws-cloudfront-create-invalidation

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amazon CloudFront "Create Invalidation" Action for GitHub Actions

Create a new invalidation on Amazon CloudFront.

Table of Contents

Usage

For a single path:

    - name: Create CloudFront invalidation
      uses: josemando/aws-cloudfront-create-invalidation@v1
      with:
        distribution-id: my-distribution-id
        paths: /*

For multiple paths:

    - name: Create CloudFront invalidation
      uses: josemando/aws-cloudfront-create-invalidation@v1
      with:
        distribution-id: my-distribution-id
        paths: |
          /index.html
          /fav.ico

See action.yml for the full documentation for this action's inputs and outputs.

Credentials and Region

This action relies on the default behavior of the AWS SDK for Javascript to determine AWS credentials and region. Use the aws-actions/configure-aws-credentials action to configure the GitHub Actions environment with environment variables containing AWS credentials and your desired region.

    - name: Configure AWS credentials
      uses: aws-actions/configure-aws-credentials@v1
      with:
        aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
        aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        aws-region: us-east-2

    - name: Create CloudFront invalidation
      uses: josemando/aws-cloudfront-create-invalidation@v1
      with:
        distribution-id: my-distribution-id
        paths: /*

We recommend following Amazon IAM best practices for the AWS credentials used in GitHub Actions workflows, including:

  • Do not store credentials in your repository's code. You may use GitHub Actions secrets to store credentials and redact credentials from GitHub Actions workflow logs.
  • Create an individual IAM user with an access key for use in GitHub Actions workflows, preferably one per repository. Do not use the AWS account root user access key.
  • Grant least privilege to the credentials used in GitHub Actions workflows. Grant only the permissions required to perform the actions in your GitHub Actions workflows. See the Permissions section below for the permissions required by this action.
  • Rotate the credentials used in GitHub Actions workflows regularly.
  • Monitor the activity of the credentials used in GitHub Actions workflows.

Permissions

This action requires the following minimum set of permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "CloudFrontCreateInvalidation",
      "Effect": "Allow",
      "Action": [
        "cloudfront:CreateInvalidation"
      ],
      "Resource": "*"
    }
  ]
}

Roadmap

  • Add option to wait until invalidation is finished
  • Add lint
  • Create tests

License Summary

This code is made available under the MIT license.

About

Create a new invalidation on Amazon CloudFront.

Resources

License

Stars

Watchers

Forks

Packages

No packages published