Created
January 13, 2020 23:42
-
-
Save rowanu/54c27d744ddad4c4d98ba62665f782d5 to your computer and use it in GitHub Desktop.
Invalidate CloudFront from CodePipeline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
InvalidateCacheProject: | |
Type: AWS::CodeBuild::Project | |
Properties: | |
Artifacts: | |
Type: CODEPIPELINE | |
Environment: | |
ComputeType: BUILD_GENERAL1_SMALL | |
Image: aws/codebuild/standard:2.0 | |
Type: LINUX_CONTAINER | |
Name: !Sub ${AWS::StackName}-invalidate-cache | |
ServiceRole: !GetAtt InvalidateCacheRole.Arn | |
Source: | |
Type: CODEPIPELINE | |
BuildSpec: | | |
version: 0.2 | |
env: | |
parameter-store: | |
# NOTE: Using here avoids circular dependency | |
DISTRIBUTION_ID: /my/distribution/id | |
phases: | |
post_build: | |
commands: | |
- aws cloudfront create-invalidation \ | |
--distribution-id ${DISTRIBUTION_ID} \ | |
--paths '/*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Name: InvalidateCache | |
Actions: | |
- Name: InvalidateCache | |
ActionTypeId: | |
Category: Build | |
Owner: AWS | |
Provider: CodeBuild | |
Version: "1" | |
Configuration: | |
ProjectName: !Ref InvalidateCacheProject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment