# Automate Your Infrastructure

**URL:** <https://discuss.dataengineercafe.io/t/automate-your-infrastructure/533>\
**Category:** 97 Things Every Data Engineer Should Know\
**Tags:** data-pipeline, infrastructure\
**Created:** [March 13, 2023, 6:54am UTC](https://discuss.dataengineercafe.io/t/automate-your-infrastructure/533 "2023-03-13T06:54:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkan](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dataengineercafe.io/zkan/32/2_2.png) [@zkan](https://discuss.dataengineercafe.io/u/zkan)\
**Post date:** [March 13, 2023, 6:54am UTC](https://discuss.dataengineercafe.io/t/automate-your-infrastructure/533/1 "2023-03-13T06:54:30Z")

</div>

โดย [Christiano Anderson](https://www.linkedin.com/in/christianoanderson/)

ในการสร้าง หรือ deploy พวก infrastructure หรือ managed services ต่าง ๆ เพื่อที่จะทำ data pipelines ก็เป็นส่วนหนึ่งในงานของ data engineers ด้วยเหมือนกัน ซึ่งของพวกนี้ในปัจจุบัน อย่างบน cloud provider เช่น AWS เราสามารถที่จะเข้าไปที่ web console แล้วกด ๆ เพื่อสร้าง component ต่าง ๆ ขึ้นมาได้เลย

แต่ถ้าเราต้องทำของพวกนี้หลาย ๆ ครั้ง ซ้ำแล้วซ้ำอีก ก็จะกลายเป็นเรื่องที่ใช้เวลานาน และอาจจะมีโอกาสเกิดขึ้นผิดพลาด รวมไปถึงเรื่อง security breach ขึ้นได้อีก

ดังนั้นเนี่ย data engineers เราจึงควรที่จะเรียนรู้ในเรื่องการ automate ส่วนต่าง ๆ หรือการทำ infrastructure as code นั่นเอง ก็จะมี guidelines ประมาณนี้

- **Never use the web console** — ใช้ infrastructure as code ไปเลย
- **Make it modular** — ทำของต่าง ๆ ให้เป็น module ไว้ เช่น API gateway กับส่วน IAM rols ก็อาจจะแยกกันเป็นคนละ module
- **Use a version-control system to manage your code** — จะมีประโยชน์มากกับทีม ในการดู history และเราสามารถที่จะทำ pull request เพื่อ code review ได้อีกด้วย
- **Test the code before applying the changes** — พยายามทดสอบโค้ดของเราก่อนที่จะ apply ใช้งานจริง เพื่อป้องกันข้อผิดพลาดในการไปพังของที่มีอยู่แล้ว
- **Use a continuous integration/continuous delivery (CI/CD) pipeline** — เราจะสามารถ automate ทุกสิ่งอย่างได้ด้วยการทำ CI/CD pipeline

ถ้าใครไม่เคยทำตามหัวข้อด้านบนเลย อยากจะให้อุทิศเวลาส่วนหนึ่งในการศึกษาเรื่องพวกนี้ และพยายามทำ infrastructure ทั้งหมดด้วย code ซึ่งความพยายามต่าง ๆ และเวลาที่เราเสียไป มันจะคุ้มค่ามาก เราสามารถที่จะควมคุม infrastructure ของเราได้ และสุดท้ายก็จะง่ายกับเราด้วยตอนที่เราอยากจะ deploy ตัว infrastructure หรือ data pipeline ของเราตัวใหม่
