在亚马逊网络服务上提供Fedora CoreOS
本指南介绍如何在Amazon Web Services(AWS)云平台上配置新的Fedora CoreOS(FCOS)实例。
先决条件
在配置FCOS计算机之前,您必须具有包含自定义设置的Ignition配置文件。如果您没有,请参见 生成Ignition文件 。
如果您不想使用Ignition入门,可以使用 加力支撑 并通过云提供商提供SSH密钥,然后从那里继续。
您还需要拥有AWS帐户的访问权限。下面的示例使用 AWS 命令行工具,必须预先单独安装和配置。
启动一个VM实例
可以直接从公共FCOS镜像创建新的AWS实例。您可以从以下地址找到每个地区的最新AMI 下载页面 。
如果您只对探索FCOS感兴趣,而没有进一步的定制,那么您可以使用 已注册的SSH密钥对 对于默认设置 core
用户。
要以这种方式测试FCOS,您需要运行 aws ec2 run-instances
命令,并提供一些信息来启动和运行该实例。以下是您可以使用的命令示例:
启动新实例
NAME='instance1'
SSHKEY='my-key' # the name of your SSH key: `aws ec2 describe-key-pairs`
IMAGE='ami-xxx' # the AMI ID found on the download page
DISK='20' # the size of the hard disk
REGION='us-east-1' # the target region
TYPE='m5.large' # the instance type
SUBNET='subnet-xxx' # the subnet: `aws ec2 describe-subnets`
SECURITY_GROUPS='sg-xx' # the security group `aws ec2 describe-security-groups`
aws ec2 run-instances \
--region $REGION \
--image-id $IMAGE \
--instance-type $TYPE \
--key-name $SSHKEY \
--subnet-id $SUBNET \
--security-group-ids $SECURITY_GROUPS \
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=${NAME}}]" \
--block-device-mappings "VirtualName=/dev/xvda,DeviceName=/dev/xvda,Ebs={VolumeSize=${DISK}}"
您可以通过运行以下命令来查找分配给实例的IP aws ec2 describe-instances
|
现在,您应该能够使用关联的IP地址通过SSH连接到该实例。
为了启动自定义的FCOS实例,必须将有效的Ignition配置作为其 用户数据 在创造的时候。您可以从上面使用相同的命令,但添加 --user-data file://path/to/config.ign
论据:
启动和定制新实例
NAME='instance1'
SSHKEY='my-key' # the name of your SSH key: `aws ec2 describe-key-pairs`
IMAGE='ami-xxx' # the AMI ID found on the download page
DISK='20' # the size of the hard disk
REGION='us-east-1' # the target region
TYPE='m5.large' # the instance type
SUBNET='subnet-xxx' # the subnet: `aws ec2 describe-subnets`
SECURITY_GROUPS='sg-xx' # the security group `aws ec2 describe-security-groups`
USERDATA='/path/to/config.ign' # path to your Ignition config
aws ec2 run-instances \
--region $REGION \
--image-id $IMAGE \
--instance-type $TYPE \
--key-name $SSHKEY \
--subnet-id $SUBNET \
--security-group-ids $SECURITY_GROUPS \
--user-data "file://${USERDATA}" \
--tag-specifications "ResourceType=instance,Tags=[{Key=Name,Value=${NAME}}]" \
--block-device-mappings "VirtualName=/dev/xvda,DeviceName=/dev/xvda,Ebs={VolumeSize=${DISK}}"
根据设计,FCOS不支持云初始化配置和启动脚本。相反,建议将任何启动逻辑编码为Ignition配置中的SYSTEM D服务单元。 |