Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
bc7f6ca5
Commit
bc7f6ca5
authored
Jul 21, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #210 from rgarcia/vpc-launch
builder/amazon: support launching in VPC
parents
05f4efc6
1ad53e10
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
2 deletions
+15
-2
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+2
-0
builder/amazon/ebs/ssh.go
builder/amazon/ebs/ssh.go
+5
-1
builder/amazon/ebs/step_run_source_instance.go
builder/amazon/ebs/step_run_source_instance.go
+1
-0
builder/amazon/ebs/step_security_group.go
builder/amazon/ebs/step_security_group.go
+1
-1
website/source/docs/builders/amazon-ebs.html.markdown
website/source/docs/builders/amazon-ebs.html.markdown
+6
-0
No files found.
builder/amazon/ebs/builder.go
View file @
bc7f6ca5
...
...
@@ -33,6 +33,8 @@ type config struct {
SSHUsername
string
`mapstructure:"ssh_username"`
SSHPort
int
`mapstructure:"ssh_port"`
SecurityGroupId
string
`mapstructure:"security_group_id"`
VpcId
string
`mapstructure:"vpc_id"`
SubnetId
string
`mapstructure:"subnet_id"`
// Configuration of the resulting AMI
AMIName
string
`mapstructure:"ami_name"`
...
...
builder/amazon/ebs/ssh.go
View file @
bc7f6ca5
...
...
@@ -10,7 +10,11 @@ import (
func
sshAddress
(
state
map
[
string
]
interface
{})
(
string
,
error
)
{
config
:=
state
[
"config"
]
.
(
config
)
instance
:=
state
[
"instance"
]
.
(
*
ec2
.
Instance
)
return
fmt
.
Sprintf
(
"%s:%d"
,
instance
.
DNSName
,
config
.
SSHPort
),
nil
if
config
.
VpcId
==
""
{
return
fmt
.
Sprintf
(
"%s:%d"
,
instance
.
DNSName
,
config
.
SSHPort
),
nil
}
else
{
return
fmt
.
Sprintf
(
"%s:%d"
,
instance
.
PrivateIpAddress
,
config
.
SSHPort
),
nil
}
}
func
sshConfig
(
state
map
[
string
]
interface
{})
(
*
gossh
.
ClientConfig
,
error
)
{
...
...
builder/amazon/ebs/step_run_source_instance.go
View file @
bc7f6ca5
...
...
@@ -26,6 +26,7 @@ func (s *stepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
MinCount
:
0
,
MaxCount
:
0
,
SecurityGroups
:
[]
ec2
.
SecurityGroup
{
ec2
.
SecurityGroup
{
Id
:
securityGroupId
}},
SubnetId
:
config
.
SubnetId
,
}
ui
.
Say
(
"Launching a source AWS instance..."
)
...
...
builder/amazon/ebs/step_security_group.go
View file @
bc7f6ca5
...
...
@@ -29,7 +29,7 @@ func (s *stepSecurityGroup) Run(state map[string]interface{}) multistep.StepActi
ui
.
Say
(
"Creating temporary security group for this instance..."
)
groupName
:=
fmt
.
Sprintf
(
"packer %s"
,
hex
.
EncodeToString
(
identifier
.
NewUUID
()
.
Raw
()))
log
.
Printf
(
"Temporary group name: %s"
,
groupName
)
groupResp
,
err
:=
ec2conn
.
CreateSecurityGroup
(
groupName
,
"Temporary group for Packer"
)
groupResp
,
err
:=
ec2conn
.
CreateSecurityGroup
(
ec2
.
SecurityGroup
{
Name
:
groupName
,
Description
:
"Temporary group for Packer"
,
VpcId
:
config
.
VpcId
}
)
if
err
!=
nil
{
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
...
...
website/source/docs/builders/amazon-ebs.html.markdown
View file @
bc7f6ca5
...
...
@@ -76,6 +76,12 @@ Optional:
before timing out. The format of this value is a duration such as "5s"
or "5m". The default SSH timeout is "1m", or one minute.
*
`subnet_id`
(string) - If using VPC, the ID of the subnet, such as
"subnet-12345def", where Packer will launch the EC2 instance.
*
`vpc_id`
(string) - If launching into a VPC subnet, Packer needs the
VPC ID in order to create a temporary security group within the VPC.
## Basic Example
Here is a basic example. It is completely valid except for the access keys:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment