hashicorp / hashicorp/packer-plugin-amazon
AWS WorkSpaces Image/Bundle Builder
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
_This issue was originally opened by @Tensho as hashicorp/packer#9916. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._
#### Community Note
Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
#### Description
AWS workspaces could be run from a [bundle](https://docs.aws.amazon.com/workspaces/latest/adminguide/amazon-workspaces-bundles.html). Bundle is a combination of an operating system, storage, compute and software resources. Bundle is based on the image. Image is essentially the same as EC2 AMIs. It would be nice to build them with Packer.
Right now there is no [AWS WorkSpace API](https://docs.aws.amazon.com/workspaces/latest/api/welcome.html) action to take (create) an image from the workspace. I've submitted a feature request for it in AWS Support.
#### Use Case
I have a lot of AWS workspaces in my current organization. They have the same Linux baseline (essential system packages, common applications) and deviations depending on the department (some extra configuration tuning or applications installed). It requires a lot of manual actions to introduce any updates to the images. I have to launch a pristine workspace from the baseline image, install the requested software, bake an image, destroy workspace, create a bundle from the new image for a new department or update the existing bundle with the new image for the existing department. AWS proposes to [manage Linux workspaces with OpsWorks (Puppet Enterprise)](https://aws.amazon.com/blogs/desktop-and-application-streaming/managing-amazon-linux-2-amazon-workspaces-with-aws-opsworks-for-puppet-enterprise). I'd prefer to manage WorkSpaces images with Packer leveraging all the benefits of immutable infrastructure.

#### Potential configuration
```
{
"builders": [
{
"type": "amazon-workspace",
"image_regions": "us-east-1,eu-central-1",
"image_users": "111111111111,222222222222",
"image_name": "acme-linux-{{ isotime \"2006-01-02-15-04-05\" }}",
"source_bundle_filter": {
"filters": {
"id": "wsb-1wpvxgh6p",
},
"owners": [
"111111111111"
]
},
"vpc_filter": {
"filters": {
"tag:Name": "main"
}
},
"subnet_filter": {
"filters": {
"tag:Tier": "private"
},
"random": true
},
"security_group_filter": {
"filters": {
"tag:Name": "packer"
}
},
"region": "us-east-1",
"ssh_username": "workspaces\packer",
"tags": {
"timestamp": "{{ timestamp }}"
}
}
],
"provisioners": [
{
"type": "ansible",
"playbook_file": "ansible/ansible.yml",
"user": "ec2-user",
"extra_arguments": [
"--become",
"--extra-vars",
"ami=true"
],
"ansible_env_vars": [
"ANSIBLE_HOST_KEY_CHECKING=False",
"ANSIBLE_NOCOLOR=True",
"ANSIBLE_SSH_ARGS='-o ControlPath=/dev/shm/control:%h:%p:%r'"
]
}
]
}
```
#### Potential References
- [AWS WorkSpaces Docs](https://docs.aws.amazon.com/workspaces/index.html)
- [AWS WorkSpaces API](https://docs.aws.amazon.com/workspaces/latest/api/welcome.html)
Contributor guide
Assessment
This issue has not been assessed yet.