I am a sucker for CI/CD pipelines. I pretty much build those out before I build any other project, to be honest. Ever since Github came out with workflow and actions I have been all over it!
我是CI / CD管道的傻瓜。 老实说,我几乎在构建任何其他项目之前就已经将它们进行了构建。 自从Github提出了工作流程和操作以来,我就已经完成了!
Instead of relying on some online rando’s actions, I went straight to the source. AWS created and support their own Github actions. AND on top of that, Github actually comes pre-installed with AWS CLI now.
我不依赖于某些网上rando的行为,而是直接参考了消息来源。 AWS创建并支持自己的Github操作 。 最重要的是, Github实际上现在已经预装了AWS CLI 。
I just wanted to simply update an S3 bucket and invalidate my Cloudfront for the bucket.
我只想简单地更新一个S3存储桶,并使该存储桶的Cloudfront无效。
First, we configure our credentials using the Github Action provided by AWS engineers, — doing God’s work.
首先,我们使用AWS工程师提供的Github Action配置我们的凭证,即完成上帝的工作 。
![use the AWS Github action to sign into credentials](https://miro.medium.com/max/9999/1*hvUaPrmbE7KO3g90qyEUvw.png)
Secondly, we then run AWS CLI like we normally would.
其次,然后像往常一样运行AWS CLI。
![Run AWS cli like any normal command](https://miro.medium.com/max/9999/1*T-b96DgbJKLpMsVv8r1qvw.png)
TL; DR (TL;DR)
- Github workflow containers come pre-installed with AWS CLI Github工作流容器已预安装AWS CLI
- AWS has its own project of AWS CLI actions to use AWS拥有自己的AWS CLI操作项目
- Above is how to update an S3 bucket and invalidate the objects in the connected Cloudfront distribution 上面是如何更新S3存储桶并使连接的Cloudfront发行版中的对象无效的方法
If you want to learn how to set up an S3 Bucket to Cloudfront for hosting then read my tutorial here.
如果您想学习如何将S3存储桶设置到Cloudfront进行托管,请在此处阅读我的教程。
翻译自: https://medium.com/@kylecalicast/official-aws-for-github-actions-21b4cb39b8d3