Code Monkey home page Code Monkey logo

powershell-createamibyname's Introduction

powershell-CreateAMIbyName

Powershell Create AMI by Name

from https://www.yobyot.com/aws/how-to-tag-amis-and-snapshots-with-aws-powershell-cmdlets/2014/10/21/

Takes an instance tag and creates an AWS snapshot and AMI.

To just take an AMI of the root disk (i.e. C drive) use CreateRootAMIbyName.ps1

To sysprep the server so EC2 administrator password can be obtained from the AWS console

  • make sure sysprep-ec2config.ps1 is on the server in the C:/Users/Administrator folder.
  • run first the RunSysprep.ps1 script before the CreateAMIbyName.ps1 or CreateRootAMIbyName.ps1 script.
  • RunSysprep.ps1 accepts an optional parameter where the script name can be specified if differently named.

This can be specified in a Jenkins pipeline via:

pipeline {
     agent any
     parameters {
        choice(choices: ['servera','serverb'],
        description: 'What EC2 Instance?', name: 'instanceNameTag')
        string(defaultValue: "backup", description: 'What comment?', name: 'note')
        booleanParam(name: 'snapebs', defaultValue: false, description: 'Snapshot attached EBS Disks? ')
     }
     stages {
         stage ('CreateAMIByName') {
             steps {
                 script {
                     git branch: 'master',
                        url: 'https://github.com/neillturner/powershell-CreateAMIbyName.git'
                     powershell returnStatus: true, script: ".\\RunSysprep.ps1 -instanceNameTag ${params.instanceNameTag}"
                     powershell returnStatus: true, script: ".\\CreateRootAMIbyName.ps1 -instanceNameTag ${params.instanceNameTag} -note ${params.note}  -snapebs \$${params.snapebs} "
                 }
             }
         }
     }
}

powershell-createamibyname's People

Contributors

neillturner avatar

Watchers

 avatar James Cloos avatar

powershell-createamibyname's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.