DevOpsDay
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # clean infrastructure - 李明穎(克里斯多福) {%hackmd B44mr9JvRMSCm5gVjQMNXA %} > 接觸的是中型的專案, 主要是 GCP/AWS 分享 ## Resource ### 我的Infra職涯小故事(ㄧ) > 一開始接手all in one架構,全塞在一個aws account內 有backend frontend RDS Route 53 Jenkins > 新的產品線,公司進行分組,開始有新的需求 - AWS費用要獨立請款 - 有自己的devops flow - 做 IaC (infrastructure as code) > 如果沿用現在的架構? - 請款:並不是每個aws service都支援tag - IaC:會不會動到別的team的infra? per project two aws accounts(prod & non-prod) ### Practices(一) * AWS * Multiple aws accounts * 天生隔離 * 搭配 Organization 更佳 * service control policies 去控制可使用的資源型別(由root account 就鎖了) - 搭配使用 terraform 時候,建議可以搭配使用 - AWS: allowed_account_ids - GCP: project ## Security ### 我的Infra職涯小故事(二) * 新分組的同仁需要登入舊有的aws account * jenkins要可以操作 project B 的 aws resource -- Jenkins 內會放大量的key & secret * 如何讓同仁在不同account作切換,key & secrets如何管理? ### Practices(二) AWS IAM Assume Role https://docs.aws.amazon.com/zh_tw/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html ![http://cobus.io/assets/media/aws_multi_account/multi_account_sts.png](https://i.imgur.com/qqa4Yis.png) * AWS * 直接用 EC2 instance profile * Jenkins master 上不會有 key * 權限都是暫時取得,很安全 * GCP * IAM impersonation * 如何在local有效存放 aws key secret & switch role * 使用 [99designs/aws-vault](https://github.com/99designs/aws-vault) * 搭配 aws cli config * AWS * 建立一個獨立的AWS account 來收攏有同仁的 iam user resources * 透過assume role/switch role 來取得正確的權限 * 同仁離職時,只要將這個account刪除即可,不會漏掉 * 優點 * IAM user resource 更好管理 * 降低 key & secret 洩漏風險 * 減少 jenkins master 機敏資料 * 不會卡住 jenkins automation(因為可能跑terraform去產resource時,要等key產好才能做下一動) ## CI/CD ### 我的Infra職涯小故事(三) - jenkins只有一台 - jenkins跑在ProjectA內,如果哪天ProjectA下線了怎麼辦 - jenkins的維護問題 ### Practices (三) - 將jenkins獨立出去 - 放到k8s,每個project,就一個jenkins master - jenkins的IAM授權,用前面的方式 (IAM assume role) 使用動態 Jenkins Slaves AWS: spot instance or GCP: preemptible vm (可以不用把 Jenkins master 開得太大, 減低 cost) 用k8s dynamic slaves,跑在jenkins master所在的k8s cluster內,提高其資源使用率 ### Practices (四) 將你的CI/CD 跟 application 分離 為了跟Jenkins 做 hook, 會把 endpoint 曝露出去. 分離可以增加隔離性. 降低對 application資源的可能影響. jenkins可能有更高的權限,是個有風險的存在 ### Practices (五) 自動化你整個 CI/CD Jenkins jobs use [JobDSL plugin](https://github.com/jenkinsci/job-dsl-plugin), 可以對 job 做 version control, 不用再對 Jenkins 做備份了. Jenkins master use [K8S helm](https://github.com/helm/helm) + [Jcasc](https://jenkins.io/projects/jcasc/) ### Practices (六) 讓 CI/CD 主要 task 在 container 內跑 local or Jenkins上都能跑 增加 local debug 的可能性 ###### tags: `DevOpsDays Taipei 2019`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully