Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support market place codes on snapshots #7

Open
nelg opened this issue Jul 13, 2019 · 2 comments
Open

Support market place codes on snapshots #7

nelg opened this issue Jul 13, 2019 · 2 comments

Comments

@nelg
Copy link

nelg commented Jul 13, 2019

Support market place codes on snapshots.

Snapshots that are of a market place image, such as Centos, have a product code.
AWS won't allow the volumes to be attached to the instance, unless the instance is stopped.

I suggest, have the script changed a bit, so it:

  1. Creates an instance per volume
  2. Stops the instance, and attaches the volume
  3. Starts the instance
  4. SSH to the instance which mounts the volume, does the tar and copy to s3
  5. Terminate the temporary instance
  6. Destroy snap volume, etc.

One could go to the extreme of:

  1. Create all the volumes for target snapshots at once. Wait for volumes to be available
  2. Create an instance per volume, with the volume attached, and user data set, so it mounts, tars it up and copies it to s3 etc. Report back to the script success, etc via sqs. All of these run at the same time.
  3. Destroy instances and snapshots.

The above would make this script work for large numbers of snapshots.

Error:

[snap-786aa206] Migrating snap-786aa206 to S3
[snap-786aa206] Tagging snapshot with "migrating"...
[snap-786aa206] Creating temporary EBS volume of type "standard" from snapshot
[snap-786aa206] Attaching vol-04de464a5f5ab334f to this instance (i-0143d3abc47eb48d9) at /dev/sdl...
[snap-786aa206] An error occurred, tagging snapshot with "migrate" so it can be retried later
[snap-786aa206] { Error: snap-786aa206: IncorrectInstanceState: Cannot attach volume 'vol-04de464a5f5ab334f' with Marketplace codes as the instance 'i-0143d3abc47eb48d9' is not in the 'stopped' state.
    at SnapshotMigrationError (/usr/lib/node_modules/snap-to-s3/lib/snap-to-s3.js:1948:3)
    at _raceToMarkSnapshot.then.then (/usr/lib/node_modules/snap-to-s3/lib/snap-to-s3.js:1682:12)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)
  error: 
   { IncorrectInstanceState: Cannot attach volume 'vol-04de464a5f5ab334f' with Marketplace codes as the instance 'i-0143d3abc47eb48d9' is not in the 'stopped' state.
       at Request.extractError (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/services/ec2.js:50:35)
       at Request.callListeners (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
       at Request.emit (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
       at Request.emit (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/request.js:683:14)
       at Request.transition (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/request.js:22:10)
       at AcceptorStateMachine.runTo (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/state_machine.js:14:12)
       at /usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/state_machine.js:26:10
       at Request.<anonymous> (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/request.js:38:9)
       at Request.<anonymous> (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/request.js:685:12)
       at Request.callListeners (/usr/lib/node_modules/snap-to-s3/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
     message: 'Cannot attach volume \'vol-04de464a5f5ab334f\' with Marketplace codes as the instance \'i-0143d3abc47eb48d9\' is not in the \'stopped\' state.',
     code: 'IncorrectInstanceState',
     time: 2019-07-12T23:44:29.034Z,
     requestId: '9523bec0-b2f2-4e82-acf6-ff3f3303c8c9',
     statusCode: 400,
     retryable: false,
     retryDelay: 99.12345406671746 },
  snapshotID: 'snap-786aa206' }

Terminating due to fatal errors.
@thenickdude
Copy link
Owner

That sounds like a really great project, but unfortunately I don't have a usecase for it myself, so I won't be working on this. Pull requests welcome though!

@nelg
Copy link
Author

nelg commented Jul 13, 2019

Also based in NZ (Auckland), and also fly (Paramotors) :)

I may end up use this tool/concept for larger scale customers (using just for my personal stuff right now).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants