AWS
Ops can integrate with your existing Amazon Web Services (AWS) account. You can use the Ops CLI to create and upload an image in your AWS account. Once, you have uploaded the image, you can also create an instance with a particular image using CLI.
We currently automate installing a vmimport role. It needs to be tied to the bucket you use and uses an unique name. If you are having trouble you might wish to see if you have an existing vmimport role defined already. You can also bypass this verification/creation step by turning on the SkipImportVerify flag as such:
Instance type Support
Nanos supports running on many of the AWS instance types including normal instance types like t2 and the newer Nitro based instances such as t3, c5, etc.
We recently introduced support for ARM based instances in the form of AWS Graviton instances 2 and 3. We also support SMP there.
Pre-requisites
Ensure your ~/.aws/credentials file is setup correctly - you can use the 'aws ec2' cli tools to verify this.
Create a bucket in S3 storage for ami creation.
Image Operations
Create Image
If you have already created an Ops project, you can update your existing config.json
. You need to add CloudConfig which mentions specific details like BucketName
.
Once, you have updated config.json
you can create an image in AWS with the following command:
For creating an image using a particular package, you need to provide the package name to ops image create
command with -p
option.
List Images
You can list existing images on AWS with ops image list
.
Delete Image
ops image delete -i <imagename>
can be used to delete an image from AWS.
Instance Operations
Create Instance
After the successful creation of an image in AWS, we can create an instance from an existing image.
Alternatively, you can pass project-id and zone with cli options.
You can also pass config, if you have mentioned project-id and zone in project's config.json.
You can provide list of ports to be exposed on aws instance via config and command line.
CLI example:
Sample config
If you need to specify a specific zone when creating the instance use the Subnet config var.
This is necessary for certain operations such as when you want to mount a volume to an instance.
VPC and Security Group
By default, ops uses the first VPC found in aws and creates a security group per instance.
You can select a different VPC or use a existing security group using the configuration file. The keys to set are CloudConfig.VPC
and CloudConfig.SecurityGroup
.
Private Static IP
By default, ops uses will rely on DHCP.
If you would like to set a static private ip you can use the following:
Note: You must choose an available IP that is within your chosen/default VPC.
List Instances
You can list instance on AWS using ops instance list
command.
Alternatively you can pass project-id and zone with cli options.
Get Logs for Instance
You can get logs from serial console of a particular instance using ops instance logs
command.
Alternatively you can pass project-id and zone with cli options.
On Nitro based systems the serial console will only show output when you are connected to it.
For production use we recommend shipping your logs to syslog or using cloudwatch.
To utilize cloudwatch you need to specify an IAM role (CloudConfig.InstanceProfile
), include the cloudwatch
and tls
klibs and specify your log group and log stream like so:
Then you can tail your logs in real-time:
Furthermore, it should be stated that shipping a lot of output through the serial console is going to degrade performance. You can explicitly disable both serial and vga using the following config:
Delete Instance
ops instance delete
command can be used to delete instance on AWS.
Alternatively you can pass project-id and zone with cli options.
Create Instance with Instance Group
OPS has initial support for putting an instance into an AWS auto scaling group. This allows you to load balance a handful of instances and scale up/down on demand.
The instance group must already be created to use this feature. When deploying through 'instance create' OPS will create a new launch template, apply it to the AWS auto scaling group, and then attach it to the instance when creating.
Elastic IP:
If you have already provisioned an elastic ip you may use it by setting it in the Cloud Config:
IPV6 Networking
IPV6 support differs from cloud to cloud. On AWS DHCPV6 is used. You can have an ip auto-assigned or you can set one yourself but you must be aware that a subnet must have IPv6 enabled.
A sample config for assigning an ip:
To test:
Be aware that you might not have IPV6 connectivity from the laptop/server you are testing from. You can verify within an instance on AWS to test connectivity.
Volumes
When you mount a volume to an AWS instance you must specify the zone modifier for the region. So instead of using:
Use
OPS will strip the zone 'c' from other operations that only require/desire region.
To set the volume type:
To set iops:
(Note: This is required for io1 and io2 volumes. It is not supported for the default of gp2. There is also a 50:1 iops to volume size ratio that is required.)
To set throughput:
(Note: This is only valid for gp3 volumes.)
Last updated